!pip install python-dotenv PyMySQL
Requirement already satisfied: python-dotenv in /usr/local/lib/python3.6/dist-packages (0.13.0) Requirement already satisfied: PyMySQL in /usr/local/lib/python3.6/dist-packages (0.9.3)
# Retrieve CPU information from the system
ncpu = !nproc
print("The number of available CPUs is:", ncpu[0])
The number of available CPUs is: 2
import os
import sys
import smtplib
import numpy as np
import pandas as pd
import requests
import json
from email.message import EmailMessage
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
from dotenv import load_dotenv
# Begin the timer for the script processing
startTimeScript = datetime.now()
# Set up the verbose flag to print detailed messages for debugging (setting True will activate!)
verbose = True
# Set up the sendNotification flag to send progress emails (setting True will send emails!)
notifyStatus = False
# Set up the parent directory location for loading the dotenv files
useColab = True
if useColab:
# Mount Google Drive locally for storing files
from google.colab import drive
drive.mount('/content/gdrive')
gdrivePrefix = '/content/gdrive/My Drive/Colab_Downloads/'
env_path = '/content/gdrive/My Drive/Colab Notebooks/'
dotenv_path = env_path + "python_script.env"
load_dotenv(dotenv_path=dotenv_path)
# Set up the dotenv file for retrieving environment variables
useLocalPC = False
if useLocalPC:
env_path = "/Users/david/PycharmProjects/"
dotenv_path = env_path + "python_script.env"
load_dotenv(dotenv_path=dotenv_path)
# Configure the plotting style
plt.style.use('seaborn')
# Set Pandas options
pd.set_option("display.max_rows", None)
pd.set_option("display.max_columns", None)
# pd.set_option("display.width", 140)
Drive already mounted at /content/gdrive; to attempt to forcibly remount, call drive.mount("/content/gdrive", force_remount=True).
stock_symbol = 'NFLX'
initial_capital = 0
# Specify the parameters for the trading strategy
fast_ma_min = 5
fast_ma_max = 20
slow_ma_min = 10
slow_ma_max = 50
ma_increment = 5
min_ma_gap = 5
model_start_date = datetime(2019, 1, 1)
print("Starting date for the model:", model_start_date)
stock_start_date = model_start_date - timedelta(days=int(slow_ma_max*1.5)) # Need more pricing data to calculate moving averages
model_end_date = datetime.now()
model_end_date = datetime(2020, 6, 29)
print("Ending date for the model:", model_end_date)
Starting date for the model: 2019-01-01 00:00:00 Ending date for the model: 2020-06-29 00:00:00
# Check and see whether the API key is available
quandl_key = os.environ.get('QUANDL_API')
if quandl_key is None: sys.exit("API key for Quandl not available. Script Processing Aborted!!!")
start_date_string = stock_start_date.strftime('%Y-%m-%d')
end_date_string = model_end_date.strftime('%Y-%m-%d')
quandl_url = "https://www.quandl.com/api/v3/datatables/SHARADAR/SEP.json?date.gte=%s&date.lte=%s&ticker=%s&api_key=%s" % (start_date_string, end_date_string, stock_symbol, quandl_key)
response = requests.get(quandl_url)
quandl_dict = json.loads(response.text)
stock_quandl = pd.DataFrame(quandl_dict['datatable']['data'])
print(len(stock_quandl), 'data points retrieved from the API call.')
if verbose: print(quandl_dict)
426 data points retrieved from the API call.
{'datatable': {'data': [['NFLX', '2020-06-29', 445.23, 447.67, 432.14, 447.24, 4816812.0, 0.0, 447.24, '2020-06-29'], ['NFLX', '2020-06-26', 466.39, 468.03, 442.24, 443.4, 6804726.0, 0.0, 443.4, '2020-06-26'], ['NFLX', '2020-06-25', 458.86, 467.01, 454.0, 465.91, 3938090.0, 0.0, 465.91, '2020-06-25'], ['NFLX', '2020-06-24', 468.54, 472.36, 454.0, 457.85, 4804903.0, 0.0, 457.85, '2020-06-24'], ['NFLX', '2020-06-23', 466.5, 474.01, 464.5, 466.26, 5948436.0, 0.0, 466.26, '2020-06-25'], ['NFLX', '2020-06-22', 455.01, 468.59, 454.21, 468.04, 6254536.0, 0.0, 468.04, '2020-06-23'], ['NFLX', '2020-06-19', 449.12, 453.97, 445.6, 453.72, 5933651.0, 0.0, 453.72, '2020-06-19'], ['NFLX', '2020-06-18', 448.73, 452.76, 442.8, 449.87, 4214274.0, 0.0, 449.87, '2020-06-18'], ['NFLX', '2020-06-17', 441.82, 450.46, 439.22, 447.77, 6529568.0, 0.0, 447.77, '2020-06-17'], ['NFLX', '2020-06-16', 425.76, 437.96, 425.18, 436.13, 5490919.0, 0.0, 436.13, '2020-06-16'], ['NFLX', '2020-06-15', 421.4, 426.49, 415.424, 425.5, 4471499.0, 0.0, 425.5, '2020-06-15'], ['NFLX', '2020-06-12', 429.0, 434.06, 412.45, 418.07, 6461127.0, 0.0, 418.07, '2020-06-12'], ['NFLX', '2020-06-11', 428.2, 445.57, 424.16, 425.56, 7418612.0, 0.0, 425.56, '2020-06-11'], ['NFLX', '2020-06-10', 436.0, 439.69, 430.55, 434.48, 4863759.0, 0.0, 434.48, '2020-06-10'], ['NFLX', '2020-06-09', 421.65, 434.73, 420.31, 434.05, 6796999.0, 0.0, 434.05, '2020-06-09'], ['NFLX', '2020-06-08', 416.0, 420.8, 406.5, 419.49, 5835230.0, 0.0, 419.49, '2020-06-08'], ['NFLX', '2020-06-05', 407.29, 420.239, 404.25, 419.6, 5099561.0, 0.0, 419.6, '2020-06-05'], ['NFLX', '2020-06-04', 422.39, 428.71, 410.03, 414.33, 5372443.0, 0.0, 414.33, '2020-06-05'], ['NFLX', '2020-06-03', 426.95, 427.1, 418.05, 421.97, 4291113.0, 0.0, 421.97, '2020-06-03'], ['NFLX', '2020-06-02', 425.87, 427.59, 419.46, 427.31, 3470777.0, 0.0, 427.31, '2020-06-03'], ['NFLX', '2020-06-01', 418.83, 426.72, 415.98, 425.92, 3748573.0, 0.0, 425.92, '2020-06-02'], ['NFLX', '2020-05-29', 417.46, 420.295, 411.85, 419.73, 5270484.0, 0.0, 419.73, '2020-05-29'], ['NFLX', '2020-05-28', 417.24, 422.372, 411.5, 413.44, 5660160.0, 0.0, 413.44, '2020-05-29'], ['NFLX', '2020-05-27', 410.38, 420.02, 397.86, 419.89, 10446339.0, 0.0, 419.89, '2020-05-27'], ['NFLX', '2020-05-26', 427.77, 428.5, 413.14, 414.77, 7881115.0, 0.0, 414.77, '2020-05-26'], ['NFLX', '2020-05-22', 437.0, 439.09, 427.18, 429.32, 5422334.0, 0.0, 429.32, '2020-05-22'], ['NFLX', '2020-05-21', 448.56, 448.96, 430.25, 436.25, 9117325.0, 0.0, 436.25, '2020-05-21'], ['NFLX', '2020-05-20', 454.25, 455.81, 444.0, 447.67, 5607257.0, 0.0, 447.67, '2020-05-20'], ['NFLX', '2020-05-19', 453.397, 458.97, 450.465, 451.04, 4810487.0, 0.0, 451.04, '2020-05-20'], ['NFLX', '2020-05-18', 451.16, 456.36, 443.35, 452.58, 7780309.0, 0.0, 452.58, '2020-05-18'], ['NFLX', '2020-05-15', 440.7, 455.0, 437.51, 454.19, 7182096.0, 0.0, 454.19, '2020-05-15'], ['NFLX', '2020-05-14', 444.9, 452.38, 432.82, 441.95, 9007467.0, 0.0, 441.95, '2020-05-14'], ['NFLX', '2020-05-13', 435.69, 447.0, 427.27, 438.27, 7014563.0, 0.0, 438.27, '2020-05-13'], ['NFLX', '2020-05-12', 442.0, 444.17, 431.36, 431.82, 4535899.0, 0.0, 431.82, '2020-05-13'], ['NFLX', '2020-05-11', 436.33, 444.89, 435.56, 440.52, 5470469.0, 0.0, 440.52, '2020-05-11'], ['NFLX', '2020-05-08', 434.14, 442.0, 433.639, 435.55, 5054308.0, 0.0, 435.55, '2020-05-08'], ['NFLX', '2020-05-07', 436.89, 438.88, 430.66, 436.53, 5650281.0, 0.0, 436.53, '2020-05-07'], ['NFLX', '2020-05-06', 429.3, 439.77, 426.385, 434.26, 6660737.0, 0.0, 434.26, '2020-05-06'], ['NFLX', '2020-05-05', 427.555, 431.0, 421.56, 424.68, 6254028.0, 0.0, 424.68, '2020-05-05'], ['NFLX', '2020-05-04', 417.78, 428.54, 414.87, 428.15, 7799058.0, 0.0, 428.15, '2020-05-05'], ['NFLX', '2020-05-01', 415.1, 427.97, 411.73, 415.27, 8299858.0, 0.0, 415.27, '2020-05-01'], ['NFLX', '2020-04-30', 410.31, 424.44, 408.0, 419.85, 7953975.0, 0.0, 419.85, '2020-04-30'], ['NFLX', '2020-04-29', 399.53, 415.86, 393.6, 411.89, 9693137.0, 0.0, 411.89, '2020-04-29'], ['NFLX', '2020-04-28', 419.99, 421.0, 402.91, 403.83, 9983797.0, 0.0, 403.83, '2020-04-28'], ['NFLX', '2020-04-27', 425.0, 429.0, 420.84, 421.38, 6257569.0, 0.0, 421.38, '2020-04-27'], ['NFLX', '2020-04-24', 425.0, 427.17, 415.88, 424.99, 8670362.0, 0.0, 424.99, '2020-04-25'], ['NFLX', '2020-04-23', 419.26, 438.413, 419.26, 426.7, 13864762.0, 0.0, 426.7, '2020-04-25'], ['NFLX', '2020-04-22', 429.725, 433.0, 413.0, 421.42, 20976718.0, 0.0, 421.42, '2020-04-22'], ['NFLX', '2020-04-21', 444.77, 447.0, 425.6, 433.83, 23177550.0, 0.0, 433.83, '2020-04-25'], ['NFLX', '2020-04-20', 435.17, 444.49, 430.56, 437.49, 12362129.0, 0.0, 437.49, '2020-04-20'], ['NFLX', '2020-04-17', 431.0, 432.0, 414.695, 422.96, 12616258.0, 0.0, 422.96, '2020-04-25'], ['NFLX', '2020-04-16', 437.0, 449.52, 431.61, 439.17, 16128666.0, 0.0, 439.17, '2020-04-25'], ['NFLX', '2020-04-15', 413.0, 434.98, 412.25, 426.75, 13561222.0, 0.0, 426.75, '2020-04-25'], ['NFLX', '2020-04-14', 397.5, 417.82, 394.847, 413.55, 11580983.0, 0.0, 413.55, '2020-04-25'], ['NFLX', '2020-04-13', 371.31, 400.51, 367.7, 396.72, 11692922.0, 0.0, 396.72, '2020-04-13'], ['NFLX', '2020-04-09', 371.06, 372.1, 363.03, 370.72, 7415166.0, 0.0, 370.72, '2020-04-09'], ['NFLX', '2020-04-08', 374.01, 378.39, 368.31, 371.12, 6762830.0, 0.0, 371.12, '2020-04-25'], ['NFLX', '2020-04-07', 380.0, 381.33, 369.34, 372.28, 7019024.0, 0.0, 372.28, '2020-04-25'], ['NFLX', '2020-04-06', 365.22, 380.29, 361.71, 379.96, 8121240.0, 0.0, 379.96, '2020-04-25'], ['NFLX', '2020-04-03', 367.36, 370.9, 357.51, 361.76, 4860768.0, 0.0, 361.76, '2020-04-25'], ['NFLX', '2020-04-02', 364.08, 370.99, 360.06, 370.08, 4554055.0, 0.0, 370.08, '2020-04-25'], ['NFLX', '2020-04-01', 376.05, 380.233, 361.02, 364.08, 6630308.0, 0.0, 364.08, '2020-04-25'], ['NFLX', '2020-03-31', 367.93, 383.01, 366.44, 375.5, 9312833.0, 0.0, 375.5, '2020-04-25'], ['NFLX', '2020-03-30', 363.0, 377.8, 361.17, 370.96, 8621964.0, 0.0, 370.96, '2020-04-25'], ['NFLX', '2020-03-27', 359.09, 368.56, 353.0, 357.12, 7948775.0, 0.0, 357.12, '2020-04-25'], ['NFLX', '2020-03-26', 344.0, 363.84, 341.73, 362.99, 7235016.0, 0.0, 362.99, '2020-04-25'], ['NFLX', '2020-03-25', 361.02, 362.0, 339.17, 342.39, 8739029.0, 0.0, 342.39, '2020-04-25'], ['NFLX', '2020-03-24', 369.99, 372.93, 353.03, 357.32, 11638683.0, 0.0, 357.32, '2020-04-25'], ['NFLX', '2020-03-23', 347.89, 366.11, 340.884, 360.27, 13449378.0, 0.0, 360.27, '2020-04-25'], ['NFLX', '2020-03-20', 342.31, 350.49, 332.0, 332.83, 10853846.0, 0.0, 332.83, '2020-04-25'], ['NFLX', '2020-03-19', 324.33, 348.51, 316.82, 332.03, 10615957.0, 0.0, 332.03, '2020-04-25'], ['NFLX', '2020-03-18', 302.395, 331.579, 300.0, 315.47, 12560908.0, 0.0, 315.47, '2020-04-25'], ['NFLX', '2020-03-17', 306.18, 322.9, 290.25, 319.75, 9916240.0, 0.0, 319.75, '2020-03-17'], ['NFLX', '2020-03-16', 306.63, 334.35, 294.75, 298.84, 10470788.0, 0.0, 298.84, '2020-04-25'], ['NFLX', '2020-03-13', 330.51, 336.42, 307.39, 336.295, 9458197.0, 0.0, 336.295, '2020-04-25'], ['NFLX', '2020-03-12', 326.5, 335.72, 307.32, 315.25, 12071591.0, 0.0, 315.25, '2020-04-25'], ['NFLX', '2020-03-11', 358.92, 362.98, 344.79, 349.92, 6014614.0, 0.0, 349.92, '2020-03-12'], ['NFLX', '2020-03-10', 356.425, 364.54, 347.85, 364.13, 7604444.0, 0.0, 364.13, '2020-04-25'], ['NFLX', '2020-03-09', 343.86, 357.47, 341.721, 346.49, 7350457.0, 0.0, 346.49, '2020-03-10'], ['NFLX', '2020-03-06', 367.7, 371.31, 356.85, 368.97, 8147165.0, 0.0, 368.97, '2020-04-25'], ['NFLX', '2020-03-05', 381.0, 391.4, 368.64, 372.78, 8746985.0, 0.0, 372.78, '2020-04-25'], ['NFLX', '2020-03-04', 377.77, 384.01, 370.51, 383.79, 5487340.0, 0.0, 383.79, '2020-04-25'], ['NFLX', '2020-03-03', 381.03, 393.52, 367.4, 368.77, 8364623.0, 0.0, 368.77, '2020-04-25'], ['NFLX', '2020-03-02', 373.11, 381.36, 364.502, 381.05, 6997891.0, 0.0, 381.05, '2020-04-25'], ['NFLX', '2020-02-28', 364.21, 376.77, 356.8, 369.03, 11178572.0, 0.0, 369.03, '2020-03-02'], ['NFLX', '2020-02-27', 371.46, 391.562, 370.596, 371.71, 10967699.0, 0.0, 371.71, '2020-04-25'], ['NFLX', '2020-02-26', 366.31, 382.0, 365.0, 379.24, 8961126.0, 0.0, 379.24, '2020-04-25'], ['NFLX', '2020-02-25', 372.0, 375.65, 357.72, 360.09, 6481243.0, 0.0, 360.09, '2020-04-25'], ['NFLX', '2020-02-24', 364.76, 372.82, 361.0, 368.7, 6936418.0, 0.0, 368.7, '2020-04-25'], ['NFLX', '2020-02-21', 385.33, 387.32, 377.901, 380.07, 3935618.0, 0.0, 380.07, '2020-04-25'], ['NFLX', '2020-02-20', 386.56, 389.7, 376.68, 386.0, 4079425.0, 0.0, 386.0, '2020-04-25'], ['NFLX', '2020-02-19', 388.12, 392.95, 384.9, 386.19, 4896368.0, 0.0, 386.19, '2020-04-25'], ['NFLX', '2020-02-18', 379.3, 389.54, 379.19, 387.78, 5180400.0, 0.0, 387.78, '2020-04-25'], ['NFLX', '2020-02-14', 381.47, 385.15, 379.434, 380.4, 3736266.0, 0.0, 380.4, '2020-04-25'], ['NFLX', '2020-02-13', 376.96, 385.37, 376.51, 381.4, 4485383.0, 0.0, 381.4, '2020-04-25'], ['NFLX', '2020-02-12', 377.18, 380.62, 375.88, 380.01, 4624772.0, 0.0, 380.01, '2020-04-25'], ['NFLX', '2020-02-11', 373.75, 378.11, 369.72, 373.69, 4772870.0, 0.0, 373.69, '2020-04-25'], ['NFLX', '2020-02-10', 365.0, 374.8, 362.52, 371.07, 5294138.0, 0.0, 371.07, '2020-04-25'], ['NFLX', '2020-02-07', 365.04, 371.8, 363.57, 366.77, 4385227.0, 0.0, 366.77, '2020-04-25'], ['NFLX', '2020-02-06', 369.6, 371.55, 362.505, 366.95, 3920428.0, 0.0, 366.95, '2020-04-25'], ['NFLX', '2020-02-05', 375.125, 375.25, 362.3, 369.67, 6437026.0, 0.0, 369.67, '2020-04-25'], ['NFLX', '2020-02-04', 361.0, 369.57, 356.096, 369.01, 7161451.0, 0.0, 369.01, '2020-04-25'], ['NFLX', '2020-02-03', 347.24, 359.63, 346.28, 358.0, 6674885.0, 0.0, 358.0, '2020-04-25'], ['NFLX', '2020-01-31', 347.39, 347.39, 340.98, 345.09, 5230001.0, 0.0, 345.09, '2020-04-25'], ['NFLX', '2020-01-30', 341.1, 348.2, 339.25, 347.74, 5328136.0, 0.0, 347.74, '2020-04-25'], ['NFLX', '2020-01-29', 349.0, 349.4, 338.55, 343.16, 7649183.0, 0.0, 343.16, '2020-04-25'], ['NFLX', '2020-01-28', 345.88, 352.4, 342.78, 348.52, 6821581.0, 0.0, 348.52, '2020-04-25'], ['NFLX', '2020-01-27', 345.95, 351.9, 341.02, 342.88, 7709482.0, 0.0, 342.88, '2020-04-25'], ['NFLX', '2020-01-24', 348.46, 359.85, 345.88, 353.16, 17939681.0, 0.0, 353.16, '2020-05-01'], ['NFLX', '2020-01-23', 326.04, 349.88, 325.01, 349.6, 18200293.0, 0.0, 349.6, '2020-05-01'], ['NFLX', '2020-01-22', 332.55, 336.3, 323.6, 326.0, 21729959.0, 0.0, 326.0, '2020-05-01'], ['NFLX', '2020-01-21', 340.0, 341.0, 332.59, 338.11, 12705288.0, 0.0, 338.11, '2020-05-01'], ['NFLX', '2020-01-17', 341.0, 341.57, 337.38, 339.67, 6066547.0, 0.0, 339.67, '2020-05-01'], ['NFLX', '2020-01-16', 343.5, 343.555, 335.85, 338.62, 5015997.0, 0.0, 338.62, '2020-05-01'], ['NFLX', '2020-01-15', 338.68, 343.17, 336.6, 339.07, 5158035.0, 0.0, 339.07, '2020-05-01'], ['NFLX', '2020-01-14', 344.4, 345.38, 335.52, 338.69, 7201544.0, 0.0, 338.69, '2020-05-01'], ['NFLX', '2020-01-13', 331.8, 340.85, 331.51, 338.92, 6216564.0, 0.0, 338.92, '2020-05-01'], ['NFLX', '2020-01-10', 337.13, 338.5, 327.27, 329.05, 4720540.0, 0.0, 329.05, '2020-05-01'], ['NFLX', '2020-01-09', 342.0, 343.42, 334.61, 335.66, 4562863.0, 0.0, 335.66, '2020-05-01'], ['NFLX', '2020-01-08', 331.49, 342.7, 331.05, 339.26, 7109117.0, 0.0, 339.26, '2020-05-01'], ['NFLX', '2020-01-07', 336.47, 336.7, 330.3, 330.75, 4742458.0, 0.0, 330.75, '2020-05-01'], ['NFLX', '2020-01-06', 323.12, 336.36, 321.2, 335.83, 5602478.0, 0.0, 335.83, '2020-05-01'], ['NFLX', '2020-01-03', 326.78, 329.86, 325.53, 325.9, 3795466.0, 0.0, 325.9, '2020-05-01'], ['NFLX', '2020-01-02', 326.1, 329.98, 324.78, 329.81, 4348493.0, 0.0, 329.81, '2020-05-01'], ['NFLX', '2019-12-31', 322.0, 324.916, 321.09, 323.57, 3714837.0, 0.0, 323.57, '2020-05-01'], ['NFLX', '2019-12-30', 329.08, 329.185, 322.86, 323.31, 4315267.0, 0.0, 323.31, '2020-05-01'], ['NFLX', '2019-12-27', 332.96, 333.82, 326.01, 329.09, 5037156.0, 0.0, 329.09, '2020-05-01'], ['NFLX', '2019-12-26', 334.6, 336.462, 332.01, 332.63, 3595854.0, 0.0, 332.63, '2020-05-01'], ['NFLX', '2019-12-24', 334.01, 335.7, 331.6, 333.2, 2019322.0, 0.0, 333.2, '2020-05-01'], ['NFLX', '2019-12-23', 337.76, 337.95, 331.02, 333.1, 5767937.0, 0.0, 333.1, '2020-05-01'], ['NFLX', '2019-12-20', 335.0, 338.0, 330.6, 336.9, 9923260.0, 0.0, 336.9, '2020-05-01'], ['NFLX', '2019-12-19', 324.5, 332.83, 324.18, 332.22, 9833355.0, 0.0, 332.22, '2020-05-01'], ['NFLX', '2019-12-18', 316.26, 325.36, 315.6, 320.8, 11210737.0, 0.0, 320.8, '2020-05-01'], ['NFLX', '2019-12-17', 307.36, 316.8, 306.6, 315.48, 10437127.0, 0.0, 315.48, '2020-05-01'], ['NFLX', '2019-12-16', 300.85, 305.71, 298.63, 304.21, 4660166.0, 0.0, 304.21, '2020-05-01'], ['NFLX', '2019-12-13', 298.5, 301.8, 297.25, 298.5, 3883069.0, 0.0, 298.5, '2020-05-01'], ['NFLX', '2019-12-12', 295.67, 299.165, 295.06, 298.44, 4771404.0, 0.0, 298.44, '2020-05-01'], ['NFLX', '2019-12-11', 294.49, 299.43, 294.2, 298.93, 5607155.0, 0.0, 298.93, '2020-05-01'], ['NFLX', '2019-12-10', 296.12, 298.94, 292.02, 293.12, 10481239.0, 0.0, 293.12, '2020-05-01'], ['NFLX', '2019-12-09', 307.35, 311.49, 302.44, 302.5, 5766006.0, 0.0, 302.5, '2020-05-01'], ['NFLX', '2019-12-06', 304.7, 307.849, 302.6, 307.35, 4459684.0, 0.0, 307.35, '2020-05-01'], ['NFLX', '2019-12-05', 305.27, 306.48, 298.81, 302.86, 4618867.0, 0.0, 302.86, '2020-05-01'], ['NFLX', '2019-12-04', 308.43, 308.43, 303.273, 304.32, 3513551.0, 0.0, 304.32, '2020-05-01'], ['NFLX', '2019-12-03', 302.22, 307.36, 301.88, 306.16, 5272447.0, 0.0, 306.16, '2020-05-01'], ['NFLX', '2019-12-02', 314.39, 314.39, 303.75, 309.99, 6223135.0, 0.0, 309.99, '2020-05-01'], ['NFLX', '2019-11-29', 315.78, 316.62, 313.34, 314.66, 2411749.0, 0.0, 314.66, '2020-05-01'], ['NFLX', '2019-11-27', 313.93, 316.82, 312.75, 315.93, 4100975.0, 0.0, 315.93, '2020-05-01'], ['NFLX', '2019-11-26', 315.0, 316.5, 311.69, 312.49, 5328348.0, 0.0, 312.49, '2020-05-01'], ['NFLX', '2019-11-25', 308.83, 315.73, 305.25, 315.55, 7878943.0, 0.0, 315.55, '2020-05-01'], ['NFLX', '2019-11-22', 309.1, 311.4, 304.41, 310.48, 5970056.0, 0.0, 310.48, '2020-05-01'], ['NFLX', '2019-11-21', 306.0, 312.69, 304.262, 311.69, 7488373.0, 0.0, 311.69, '2020-05-01'], ['NFLX', '2019-11-20', 301.01, 308.25, 301.0, 305.16, 5115546.0, 0.0, 305.16, '2020-05-01'], ['NFLX', '2019-11-19', 304.01, 305.67, 298.52, 302.6, 5919710.0, 0.0, 302.6, '2020-05-01'], ['NFLX', '2019-11-18', 296.0, 304.99, 293.28, 302.57, 8621566.0, 0.0, 302.57, '2020-05-01'], ['NFLX', '2019-11-15', 290.59, 295.819, 287.568, 295.03, 6337779.0, 0.0, 295.03, '2020-05-01'], ['NFLX', '2019-11-14', 283.25, 290.63, 283.22, 289.62, 6539771.0, 0.0, 289.62, '2019-11-14'], ['NFLX', '2019-11-13', 291.03, 293.41, 281.14, 283.11, 9233066.0, 0.0, 283.11, '2020-05-01'], ['NFLX', '2019-11-12', 295.32, 295.345, 288.7, 292.01, 5774833.0, 0.0, 292.01, '2020-05-01'], ['NFLX', '2019-11-11', 289.16, 296.36, 288.5, 294.18, 3945885.0, 0.0, 294.18, '2020-05-01'], ['NFLX', '2019-11-08', 288.73, 293.99, 287.505, 291.57, 4509588.0, 0.0, 291.57, '2020-05-01'], ['NFLX', '2019-11-07', 290.7, 298.19, 288.268, 289.57, 5928471.0, 0.0, 289.57, '2020-05-01'], ['NFLX', '2019-11-06', 288.19, 290.56, 285.84, 288.59, 3438257.0, 0.0, 288.59, '2020-05-01'], ['NFLX', '2019-11-05', 289.99, 291.19, 286.31, 288.03, 4062370.0, 0.0, 288.03, '2020-05-01'], ['NFLX', '2019-11-04', 288.0, 295.39, 287.16, 292.86, 5566213.0, 0.0, 292.86, '2020-05-01'], ['NFLX', '2019-11-01', 288.7, 289.12, 283.02, 286.81, 5594293.0, 0.0, 286.81, '2020-05-01'], ['NFLX', '2019-10-31', 291.0, 291.45, 284.78, 287.41, 5090021.0, 0.0, 287.41, '2020-05-01'], ['NFLX', '2019-10-30', 284.34, 293.49, 283.0, 291.45, 9345562.0, 0.0, 291.45, '2020-05-01'], ['NFLX', '2019-10-29', 281.87, 284.41, 277.545, 281.21, 4356181.0, 0.0, 281.21, '2020-05-01'], ['NFLX', '2019-10-28', 278.05, 285.75, 277.35, 281.86, 6248433.0, 0.0, 281.86, '2020-05-01'], ['NFLX', '2019-10-25', 270.68, 277.77, 270.18, 276.82, 4747829.0, 0.0, 276.82, '2020-05-01'], ['NFLX', '2019-10-24', 271.81, 274.02, 268.8, 271.5, 4911033.0, 0.0, 271.5, '2020-05-01'], ['NFLX', '2019-10-23', 268.06, 273.92, 266.63, 271.27, 7154430.0, 0.0, 271.27, '2020-05-01'], ['NFLX', '2019-10-22', 271.159, 275.41, 265.8, 266.69, 11865593.0, 0.0, 266.69, '2020-05-01'], ['NFLX', '2019-10-21', 272.89, 279.94, 269.0, 278.05, 12599173.0, 0.0, 278.05, '2020-05-01'], ['NFLX', '2019-10-18', 289.36, 290.9, 273.36, 275.3, 23212468.0, 0.0, 275.3, '2020-05-01'], ['NFLX', '2019-10-17', 304.49, 308.75, 288.3, 293.35, 38462343.0, 0.0, 293.35, '2020-05-01'], ['NFLX', '2019-10-16', 283.12, 288.17, 280.743, 286.28, 18413335.0, 0.0, 286.28, '2020-05-01'], ['NFLX', '2019-10-15', 283.82, 285.87, 279.4, 284.25, 7728161.0, 0.0, 284.25, '2020-05-01'], ['NFLX', '2019-10-14', 283.93, 286.93, 282.0, 285.53, 5543120.0, 0.0, 285.53, '2020-05-01'], ['NFLX', '2019-10-11', 284.8, 287.87, 275.895, 282.93, 8817301.0, 0.0, 282.93, '2019-10-11'], ['NFLX', '2019-10-10', 265.97, 280.53, 265.034, 280.48, 10961191.0, 0.0, 280.48, '2020-05-01'], ['NFLX', '2019-10-09', 270.02, 271.0, 264.57, 267.53, 6843488.0, 0.0, 267.53, '2020-05-01'], ['NFLX', '2019-10-08', 273.03, 275.53, 270.643, 270.72, 6302269.0, 0.0, 270.72, '2020-05-01'], ['NFLX', '2019-10-07', 271.99, 276.68, 271.28, 274.46, 6796811.0, 0.0, 274.46, '2020-05-01'], ['NFLX', '2019-10-04', 268.2, 275.485, 266.47, 272.79, 9992774.0, 0.0, 272.79, '2020-05-01'], ['NFLX', '2019-10-03', 267.78, 268.843, 257.01, 268.15, 9068810.0, 0.0, 268.15, '2020-05-01'], ['NFLX', '2019-10-02', 263.61, 269.35, 262.19, 268.03, 7773299.0, 0.0, 268.03, '2020-05-01'], ['NFLX', '2019-10-01', 267.35, 272.2, 264.03, 269.58, 8786284.0, 0.0, 269.58, '2020-05-01'], ['NFLX', '2019-09-30', 264.0, 268.88, 262.78, 267.62, 6823100.0, 0.0, 267.62, '2020-05-01'], ['NFLX', '2019-09-27', 266.175, 267.44, 260.39, 263.08, 7367491.0, 0.0, 263.08, '2020-05-01'], ['NFLX', '2019-09-26', 266.42, 268.05, 260.2, 263.31, 7696858.0, 0.0, 263.31, '2020-05-01'], ['NFLX', '2019-09-25', 255.71, 266.6, 253.7, 264.75, 11846748.0, 0.0, 264.75, '2020-05-01'], ['NFLX', '2019-09-24', 262.5, 265.0, 252.28, 254.59, 16392808.0, 0.0, 254.59, '2020-05-01'], ['NFLX', '2019-09-23', 268.345, 273.39, 261.89, 265.92, 13610294.0, 0.0, 265.92, '2020-05-01'], ['NFLX', '2019-09-20', 280.26, 282.5, 266.0, 270.75, 23954192.0, 0.0, 270.75, '2020-05-01'], ['NFLX', '2019-09-19', 291.56, 293.81, 283.4, 286.6, 8545761.0, 0.0, 286.6, '2020-05-01'], ['NFLX', '2019-09-18', 294.99, 296.05, 287.45, 291.56, 7841539.0, 0.0, 291.56, '2020-05-01'], ['NFLX', '2019-09-17', 294.5, 299.15, 291.79, 298.6, 4817119.0, 0.0, 298.6, '2020-05-01'], ['NFLX', '2019-09-16', 294.23, 297.43, 289.78, 294.29, 5307386.0, 0.0, 294.29, '2020-05-01'], ['NFLX', '2019-09-13', 290.61, 296.62, 290.04, 294.15, 6583124.0, 0.0, 294.15, '2020-05-01'], ['NFLX', '2019-09-12', 288.1, 292.73, 286.6, 288.86, 5010927.0, 0.0, 288.86, '2020-05-01'], ['NFLX', '2019-09-11', 285.7, 292.65, 284.61, 288.27, 7405949.0, 0.0, 288.27, '2020-05-01'], ['NFLX', '2019-09-10', 291.16, 297.17, 282.663, 287.99, 12320248.0, 0.0, 287.99, '2020-05-01'], ['NFLX', '2019-09-09', 294.81, 301.55, 290.6, 294.34, 8232744.0, 0.0, 294.34, '2020-05-01'], ['NFLX', '2019-09-06', 293.35, 293.35, 287.03, 290.17, 4960356.0, 0.0, 290.17, '2020-05-01'], ['NFLX', '2019-09-05', 285.32, 293.97, 282.785, 293.25, 8972356.0, 0.0, 293.25, '2020-05-01'], ['NFLX', '2019-09-04', 291.25, 292.38, 286.51, 291.52, 4653665.0, 0.0, 291.52, '2020-05-01'], ['NFLX', '2019-09-03', 290.82, 293.9, 288.06, 289.29, 3684177.0, 0.0, 289.29, '2020-05-01'], ['NFLX', '2019-08-30', 298.78, 298.94, 290.85, 293.75, 4447990.0, 0.0, 293.75, '2020-05-01'], ['NFLX', '2019-08-29', 295.0, 299.93, 294.99, 296.78, 4392532.0, 0.0, 296.78, '2020-05-01'], ['NFLX', '2019-08-28', 289.47, 292.82, 287.75, 291.77, 3958043.0, 0.0, 291.77, '2020-05-01'], ['NFLX', '2019-08-27', 294.54, 296.77, 287.197, 291.03, 6314559.0, 0.0, 291.03, '2020-05-01'], ['NFLX', '2019-08-26', 295.24, 296.95, 292.5, 294.98, 4696982.0, 0.0, 294.98, '2019-08-26'], ['NFLX', '2019-08-23', 295.0, 299.01, 290.32, 291.44, 6331189.0, 0.0, 291.44, '2020-05-01'], ['NFLX', '2019-08-22', 298.65, 300.33, 293.15, 296.93, 4977042.0, 0.0, 296.93, '2020-05-01'], ['NFLX', '2019-08-21', 301.61, 302.88, 296.2, 297.81, 5689746.0, 0.0, 297.81, '2020-05-01'], ['NFLX', '2019-08-20', 304.57, 305.0, 297.681, 298.99, 7352162.0, 0.0, 298.99, '2020-05-01'], ['NFLX', '2019-08-19', 306.25, 311.75, 304.75, 309.38, 4951733.0, 0.0, 309.38, '2020-05-01'], ['NFLX', '2019-08-16', 298.86, 303.55, 296.27, 302.8, 7090757.0, 0.0, 302.8, '2020-05-01'], ['NFLX', '2019-08-15', 299.5, 300.63, 288.0, 295.76, 9683384.0, 0.0, 295.76, '2020-05-01'], ['NFLX', '2019-08-14', 308.01, 308.41, 298.005, 299.11, 7355753.0, 0.0, 299.11, '2020-05-01'], ['NFLX', '2019-08-13', 309.77, 316.43, 308.16, 312.28, 5338761.0, 0.0, 312.28, '2020-05-01'], ['NFLX', '2019-08-12', 305.46, 312.89, 303.24, 310.83, 6531722.0, 0.0, 310.83, '2020-05-01'], ['NFLX', '2019-08-09', 313.74, 316.64, 305.68, 308.93, 5349059.0, 0.0, 308.93, '2020-05-01'], ['NFLX', '2019-08-08', 311.03, 316.365, 306.63, 315.9, 5905865.0, 0.0, 315.9, '2020-05-01'], ['NFLX', '2019-08-07', 302.56, 305.0, 296.813, 304.29, 9322433.0, 0.0, 304.29, '2020-05-01'], ['NFLX', '2019-08-06', 310.58, 311.88, 305.3, 310.1, 6179090.0, 0.0, 310.1, '2020-05-01'], ['NFLX', '2019-08-05', 310.96, 313.418, 304.677, 307.63, 8692485.0, 0.0, 307.63, '2020-05-01'], ['NFLX', '2019-08-02', 317.49, 319.41, 311.8, 318.83, 6280343.0, 0.0, 318.83, '2020-05-01'], ['NFLX', '2019-08-01', 324.25, 328.58, 318.735, 319.5, 6563156.0, 0.0, 319.5, '2020-05-01'], ['NFLX', '2019-07-31', 325.16, 331.77, 318.53, 322.99, 6259494.0, 0.0, 322.99, '2020-05-01'], ['NFLX', '2019-07-30', 329.2, 329.65, 323.23, 325.93, 6029320.0, 0.0, 325.93, '2020-05-01'], ['NFLX', '2019-07-29', 335.98, 336.4, 328.77, 332.7, 5782817.0, 0.0, 332.7, '2020-05-01'], ['NFLX', '2019-07-26', 328.79, 336.0, 327.5, 335.78, 10847495.0, 0.0, 335.78, '2020-05-01'], ['NFLX', '2019-07-25', 318.86, 327.69, 316.3, 326.46, 10798496.0, 0.0, 326.46, '2020-05-01'], ['NFLX', '2019-07-24', 310.51, 319.99, 307.25, 317.94, 11961818.0, 0.0, 317.94, '2020-05-01'], ['NFLX', '2019-07-23', 311.44, 313.5, 306.0, 307.3, 9171068.0, 0.0, 307.3, '2020-05-01'], ['NFLX', '2019-07-22', 312.0, 314.54, 305.81, 310.62, 17725334.0, 0.0, 310.62, '2020-05-01'], ['NFLX', '2019-07-19', 323.4, 325.85, 314.23, 315.1, 16302482.0, 0.0, 315.1, '2020-05-01'], ['NFLX', '2019-07-18', 323.76, 329.85, 320.3, 325.21, 31305899.0, 0.0, 325.21, '2020-05-01'], ['NFLX', '2019-07-17', 366.25, 366.5, 361.75, 362.44, 13639536.0, 0.0, 362.44, '2020-05-01'], ['NFLX', '2019-07-16', 370.09, 371.34, 364.92, 365.99, 5863222.0, 0.0, 365.99, '2020-05-01'], ['NFLX', '2019-07-15', 372.94, 373.68, 362.3, 366.6, 7944680.0, 0.0, 366.6, '2020-05-01'], ['NFLX', '2019-07-12', 378.68, 379.738, 372.792, 373.25, 6636937.0, 0.0, 373.25, '2020-05-01'], ['NFLX', '2019-07-11', 381.1, 384.54, 378.8, 379.5, 4336287.0, 0.0, 379.5, '2020-05-01'], ['NFLX', '2019-07-10', 382.77, 384.34, 377.4, 381.0, 5878790.0, 0.0, 381.0, '2020-05-01'], ['NFLX', '2019-07-09', 379.06, 384.76, 377.5, 379.93, 6932822.0, 0.0, 379.93, '2020-05-01'], ['NFLX', '2019-07-08', 378.19, 378.25, 375.36, 376.16, 3113402.0, 0.0, 376.16, '2020-05-01'], ['NFLX', '2019-07-05', 378.29, 381.4, 375.555, 380.55, 3732162.0, 0.0, 380.55, '2020-05-01'], ['NFLX', '2019-07-03', 376.69, 381.99, 375.84, 381.72, 3799009.0, 0.0, 381.72, '2020-05-01'], ['NFLX', '2019-07-02', 374.89, 376.0, 370.31, 375.43, 3628962.0, 0.0, 375.43, '2020-05-01'], ['NFLX', '2019-07-01', 373.5, 376.66, 372.0, 374.6, 5001518.0, 0.0, 374.6, '2020-05-01'], ['NFLX', '2019-06-28', 370.26, 371.545, 364.87, 367.32, 4592706.0, 0.0, 367.32, '2020-05-01'], ['NFLX', '2019-06-27', 363.2, 370.85, 363.2, 370.02, 4138575.0, 0.0, 370.02, '2020-05-01'], ['NFLX', '2019-06-26', 361.6, 366.79, 361.6, 362.2, 3669677.0, 0.0, 362.2, '2020-05-01'], ['NFLX', '2019-06-25', 370.75, 370.999, 358.29, 360.3, 5750383.0, 0.0, 360.3, '2020-05-01'], ['NFLX', '2019-06-24', 370.27, 375.0, 370.2, 371.04, 4830240.0, 0.0, 371.04, '2020-05-01'], ['NFLX', '2019-06-21', 365.0, 371.45, 365.0, 369.21, 7448356.0, 0.0, 369.21, '2020-05-01'], ['NFLX', '2019-06-20', 365.91, 370.12, 361.215, 365.21, 5899467.0, 0.0, 365.21, '2020-05-01'], ['NFLX', '2019-06-19', 361.72, 364.74, 356.12, 363.52, 5667156.0, 0.0, 363.52, '2020-05-01'], ['NFLX', '2019-06-18', 355.57, 361.5, 353.75, 357.12, 5428542.0, 0.0, 357.12, '2020-05-01'], ['NFLX', '2019-06-17', 342.69, 351.77, 342.06, 350.62, 5358219.0, 0.0, 350.62, '2020-05-01'], ['NFLX', '2019-06-14', 341.63, 343.4, 336.155, 339.73, 5019011.0, 0.0, 339.73, '2020-05-01'], ['NFLX', '2019-06-13', 347.23, 348.5, 339.25, 343.43, 6209347.0, 0.0, 343.43, '2020-05-01'], ['NFLX', '2019-06-12', 351.82, 353.61, 343.23, 345.56, 4584704.0, 0.0, 345.56, '2020-05-01'], ['NFLX', '2019-06-11', 355.0, 357.58, 348.5, 351.27, 5396712.0, 0.0, 351.27, '2020-05-01'], ['NFLX', '2019-06-10', 363.65, 367.1, 349.285, 352.01, 7810261.0, 0.0, 352.01, '2020-05-01'], ['NFLX', '2019-06-07', 357.39, 365.15, 355.69, 360.87, 4777321.0, 0.0, 360.87, '2020-05-01'], ['NFLX', '2019-06-06', 354.84, 358.21, 352.09, 357.13, 3709955.0, 0.0, 357.13, '2020-05-01'], ['NFLX', '2019-06-05', 354.38, 357.88, 348.71, 355.73, 5020081.0, 0.0, 355.73, '2020-05-01'], ['NFLX', '2019-06-04', 345.0, 353.61, 343.25, 353.4, 7891632.0, 0.0, 353.4, '2020-05-01'], ['NFLX', '2019-06-03', 343.56, 347.66, 332.65, 336.63, 7849589.0, 0.0, 336.63, '2020-05-01'], ['NFLX', '2019-05-31', 347.22, 349.34, 342.92, 343.28, 5023449.0, 0.0, 343.28, '2020-05-01'], ['NFLX', '2019-05-30', 350.55, 354.21, 348.3, 351.85, 4008042.0, 0.0, 351.85, '2020-05-01'], ['NFLX', '2019-05-29', 353.6, 353.848, 345.9, 349.19, 5658913.0, 0.0, 349.19, '2020-05-01'], ['NFLX', '2019-05-28', 354.39, 361.2, 353.64, 354.78, 4717144.0, 0.0, 354.78, '2020-05-01'], ['NFLX', '2019-05-24', 355.41, 359.44, 353.791, 354.39, 3830963.0, 0.0, 354.39, '2020-05-01'], ['NFLX', '2019-05-23', 355.5, 357.42, 347.7, 352.21, 5630443.0, 0.0, 352.21, '2020-05-01'], ['NFLX', '2019-05-22', 358.01, 370.46, 357.3, 359.73, 6229389.0, 0.0, 359.73, '2020-05-01'], ['NFLX', '2019-05-21', 350.95, 356.425, 349.93, 354.27, 4026369.0, 0.0, 354.27, '2020-05-01'], ['NFLX', '2019-05-20', 351.23, 352.418, 345.4, 348.11, 4621515.0, 0.0, 348.11, '2020-05-01'], ['NFLX', '2019-05-17', 356.39, 359.62, 353.785, 354.45, 4725448.0, 0.0, 354.45, '2020-05-01'], ['NFLX', '2019-05-16', 356.37, 364.0, 353.935, 359.31, 6441463.0, 0.0, 359.31, '2020-05-01'], ['NFLX', '2019-05-15', 343.34, 356.5, 341.39, 354.99, 6340118.0, 0.0, 354.99, '2020-05-01'], ['NFLX', '2019-05-14', 348.71, 349.95, 342.5, 345.61, 5353029.0, 0.0, 345.61, '2020-05-01'], ['NFLX', '2019-05-13', 352.29, 354.26, 343.1, 345.26, 8026697.0, 0.0, 345.26, '2020-05-01'], ['NFLX', '2019-05-10', 361.62, 365.258, 353.06, 361.04, 5657123.0, 0.0, 361.04, '2020-05-01'], ['NFLX', '2019-05-09', 360.9, 364.2, 352.75, 362.75, 5882572.0, 0.0, 362.75, '2020-05-01'], ['NFLX', '2019-05-08', 367.92, 369.0, 361.36, 364.37, 6571957.0, 0.0, 364.37, '2020-05-01'], ['NFLX', '2019-05-07', 377.0, 379.91, 365.81, 370.46, 6974924.0, 0.0, 370.46, '2020-05-01'], ['NFLX', '2019-05-06', 377.69, 381.35, 376.0, 378.67, 5793144.0, 0.0, 378.67, '2020-05-01'], ['NFLX', '2019-05-03', 381.53, 385.03, 378.272, 385.03, 5130301.0, 0.0, 385.03, '2020-05-01'], ['NFLX', '2019-05-02', 378.0, 383.5, 374.51, 379.06, 5398167.0, 0.0, 379.06, '2020-05-01'], ['NFLX', '2019-05-01', 374.0, 385.99, 373.175, 378.81, 9257284.0, 0.0, 378.81, '2020-05-01'], ['NFLX', '2019-04-30', 369.56, 374.5, 368.348, 370.54, 3870095.0, 0.0, 370.54, '2020-05-01'], ['NFLX', '2019-04-29', 373.68, 374.575, 369.115, 371.83, 3821703.0, 0.0, 371.83, '2020-05-01'], ['NFLX', '2019-04-26', 368.35, 375.14, 366.24, 374.85, 5621901.0, 0.0, 374.85, '2020-05-01'], ['NFLX', '2019-04-25', 374.49, 374.76, 365.7, 368.33, 6255496.0, 0.0, 368.33, '2020-05-01'], ['NFLX', '2019-04-24', 381.07, 381.9, 373.27, 374.23, 6541872.0, 0.0, 374.23, '2020-05-01'], ['NFLX', '2019-04-23', 375.45, 384.8, 374.707, 381.89, 10089820.0, 0.0, 381.89, '2020-05-01'], ['NFLX', '2019-04-22', 359.7, 377.69, 359.0, 377.34, 11980534.0, 0.0, 377.34, '2020-05-01'], ['NFLX', '2019-04-18', 355.0, 360.41, 351.64, 360.35, 8353165.0, 0.0, 360.35, '2020-05-01'], ['NFLX', '2019-04-17', 365.05, 368.764, 350.6, 354.74, 18054101.0, 0.0, 354.74, '2020-05-01'], ['NFLX', '2019-04-16', 355.0, 364.479, 352.72, 359.46, 18740232.0, 0.0, 359.46, '2020-05-01'], ['NFLX', '2019-04-15', 350.71, 352.21, 342.27, 348.87, 8842344.0, 0.0, 348.87, '2020-05-01'], ['NFLX', '2019-04-12', 360.69, 361.75, 349.36, 351.14, 15646199.0, 0.0, 351.14, '2020-05-01'], ['NFLX', '2019-04-11', 365.0, 370.12, 360.81, 367.65, 6526899.0, 0.0, 367.65, '2020-05-01'], ['NFLX', '2019-04-10', 365.79, 368.848, 362.25, 363.92, 4545561.0, 0.0, 363.92, '2020-05-01'], ['NFLX', '2019-04-09', 360.54, 366.74, 359.0, 364.71, 5439228.0, 0.0, 364.71, '2020-05-01'], ['NFLX', '2019-04-08', 365.11, 365.94, 359.93, 361.41, 4653810.0, 0.0, 361.41, '2020-05-01'], ['NFLX', '2019-04-05', 369.0, 369.8, 364.66, 365.49, 3905493.0, 0.0, 365.49, '2020-05-01'], ['NFLX', '2019-04-04', 370.07, 372.05, 362.4, 367.88, 4627305.0, 0.0, 367.88, '2020-05-01'], ['NFLX', '2019-04-03', 369.26, 373.411, 366.19, 369.75, 5376623.0, 0.0, 369.75, '2020-05-01'], ['NFLX', '2019-04-02', 366.25, 368.42, 362.22, 367.72, 5158742.0, 0.0, 367.72, '2020-05-01'], ['NFLX', '2019-04-01', 359.0, 368.33, 358.51, 366.96, 7036097.0, 0.0, 366.96, '2020-05-01'], ['NFLX', '2019-03-29', 357.16, 358.25, 353.71, 356.56, 4705636.0, 0.0, 356.56, '2020-05-01'], ['NFLX', '2019-03-28', 354.485, 355.94, 349.2, 354.61, 4360960.0, 0.0, 354.61, '2020-05-01'], ['NFLX', '2019-03-27', 361.0, 362.47, 350.37, 353.37, 7852370.0, 0.0, 353.37, '2020-05-01'], ['NFLX', '2019-03-26', 367.87, 368.38, 358.02, 359.97, 7666475.0, 0.0, 359.97, '2020-05-01'], ['NFLX', '2019-03-25', 359.0, 367.04, 357.44, 366.23, 8473845.0, 0.0, 366.23, '2020-05-01'], ['NFLX', '2019-03-22', 375.95, 376.43, 360.04, 361.01, 8661346.0, 0.0, 361.01, '2020-05-01'], ['NFLX', '2019-03-21', 374.0, 379.0, 370.61, 377.87, 8544017.0, 0.0, 377.87, '2020-05-01'], ['NFLX', '2019-03-20', 358.91, 375.9, 357.01, 375.22, 10917165.0, 0.0, 375.22, '2020-05-01'], ['NFLX', '2019-03-19', 366.4, 366.96, 356.8, 358.78, 7541425.0, 0.0, 358.78, '2020-05-01'], ['NFLX', '2019-03-18', 362.47, 370.971, 361.86, 363.44, 7194726.0, 0.0, 363.44, '2019-03-18'], ['NFLX', '2019-03-15', 361.02, 364.0, 358.89, 361.46, 8443210.0, 0.0, 361.46, '2020-05-01'], ['NFLX', '2019-03-14', 360.5, 363.84, 358.101, 358.82, 5271429.0, 0.0, 358.82, '2020-05-01'], ['NFLX', '2019-03-13', 355.81, 362.48, 352.765, 361.21, 6444092.0, 0.0, 361.21, '2020-05-01'], ['NFLX', '2019-03-12', 359.37, 360.13, 353.8, 356.27, 5164571.0, 0.0, 356.27, '2020-05-01'], ['NFLX', '2019-03-11', 352.0, 358.98, 350.03, 358.86, 5387285.0, 0.0, 358.86, '2020-05-01'], ['NFLX', '2019-03-08', 345.75, 349.92, 342.47, 349.6, 6898838.0, 0.0, 349.6, '2020-05-01'], ['NFLX', '2019-03-07', 360.16, 362.86, 350.5, 352.6, 6151331.0, 0.0, 352.6, '2020-05-01'], ['NFLX', '2019-03-06', 353.6, 359.88, 351.7, 359.61, 6211895.0, 0.0, 359.61, '2020-05-01'], ['NFLX', '2019-03-05', 351.46, 356.17, 348.25, 354.3, 5937754.0, 0.0, 354.3, '2020-05-01'], ['NFLX', '2019-03-04', 359.72, 362.25, 348.044, 351.04, 7486996.0, 0.0, 351.04, '2020-05-01'], ['NFLX', '2019-03-01', 362.26, 362.87, 354.692, 357.32, 5526539.0, 0.0, 357.32, '2020-05-01'], ['NFLX', '2019-02-28', 362.47, 366.39, 357.709, 358.1, 6186763.0, 0.0, 358.1, '2020-05-01'], ['NFLX', '2019-02-27', 363.5, 368.03, 359.8, 362.87, 5629945.0, 0.0, 362.87, '2020-05-01'], ['NFLX', '2019-02-26', 362.98, 365.7, 359.33, 364.97, 4944593.0, 0.0, 364.97, '2020-05-01'], ['NFLX', '2019-02-25', 367.01, 371.49, 363.79, 363.91, 7569320.0, 0.0, 363.91, '2020-05-01'], ['NFLX', '2019-02-22', 360.34, 366.13, 360.05, 363.02, 7088214.0, 0.0, 363.02, '2020-05-01'], ['NFLX', '2019-02-21', 360.03, 362.85, 353.88, 356.97, 6227897.0, 0.0, 356.97, '2020-05-01'], ['NFLX', '2019-02-20', 364.85, 366.71, 356.7, 359.91, 8110741.0, 0.0, 359.91, '2020-05-01'], ['NFLX', '2019-02-19', 355.8, 365.0, 355.32, 361.92, 7396559.0, 0.0, 361.92, '2020-05-01'], ['NFLX', '2019-02-15', 358.47, 364.4, 355.5, 356.87, 9229980.0, 0.0, 356.87, '2020-05-01'], ['NFLX', '2019-02-14', 351.75, 360.45, 348.33, 359.07, 9295338.0, 0.0, 359.07, '2020-05-01'], ['NFLX', '2019-02-13', 357.3, 359.6, 350.28, 351.77, 10559146.0, 0.0, 351.77, '2020-05-01'], ['NFLX', '2019-02-12', 348.09, 360.0, 346.52, 359.97, 10429399.0, 0.0, 359.97, '2020-05-01'], ['NFLX', '2019-02-11', 350.0, 352.87, 344.81, 345.73, 5454863.0, 0.0, 345.73, '2020-05-01'], ['NFLX', '2019-02-08', 338.0, 348.0, 338.0, 347.57, 7561391.0, 0.0, 347.57, '2020-05-01'], ['NFLX', '2019-02-07', 347.9, 348.75, 339.02, 344.71, 7864529.0, 0.0, 344.71, '2020-05-01'], ['NFLX', '2019-02-06', 357.0, 357.04, 347.19, 352.19, 6717662.0, 0.0, 352.19, '2020-05-01'], ['NFLX', '2019-02-05', 353.2, 360.0, 352.9, 355.81, 9046623.0, 0.0, 355.81, '2020-05-01'], ['NFLX', '2019-02-04', 342.6, 352.0, 341.3, 351.34, 9051387.0, 0.0, 351.34, '2020-05-01'], ['NFLX', '2019-02-01', 337.18, 346.84, 336.5, 339.85, 9827760.0, 0.0, 339.85, '2020-05-01'], ['NFLX', '2019-01-31', 339.68, 345.99, 338.092, 339.5, 8535517.0, 0.0, 339.5, '2020-05-01'], ['NFLX', '2019-01-30', 332.75, 341.78, 330.8, 340.66, 9234530.0, 0.0, 340.66, '2020-05-01'], ['NFLX', '2019-01-29', 335.87, 338.22, 328.151, 328.9, 7655189.0, 0.0, 328.9, '2020-05-01'], ['NFLX', '2019-01-28', 334.7, 336.3, 328.88, 335.66, 8652082.0, 0.0, 335.66, '2020-05-01'], ['NFLX', '2019-01-25', 328.72, 340.0, 328.51, 338.05, 11166609.0, 0.0, 338.05, '2020-05-01'], ['NFLX', '2019-01-24', 320.6, 331.8, 319.0, 326.67, 11131627.0, 0.0, 326.67, '2020-05-01'], ['NFLX', '2019-01-23', 328.25, 331.75, 318.6, 321.99, 13480138.0, 0.0, 321.99, '2020-05-01'], ['NFLX', '2019-01-22', 334.89, 336.88, 321.03, 325.16, 17941416.0, 0.0, 325.16, '2020-05-01'], ['NFLX', '2019-01-18', 351.97, 353.0, 336.73, 339.1, 26621040.0, 0.0, 339.1, '2020-05-01'], ['NFLX', '2019-01-17', 349.5, 355.79, 346.41, 353.19, 18871195.0, 0.0, 353.19, '2020-05-01'], ['NFLX', '2019-01-16', 354.0, 358.85, 348.11, 351.39, 15385548.0, 0.0, 351.39, '2020-05-01'], ['NFLX', '2019-01-15', 349.6, 357.22, 347.0, 354.64, 21181234.0, 0.0, 354.64, '2020-05-01'], ['NFLX', '2019-01-14', 334.24, 335.48, 329.13, 332.94, 10499582.0, 0.0, 332.94, '2020-05-01'], ['NFLX', '2019-01-11', 330.96, 341.09, 328.52, 337.59, 19500429.0, 0.0, 337.59, '2020-05-01'], ['NFLX', '2019-01-10', 314.57, 325.37, 312.5, 324.66, 13472475.0, 0.0, 324.66, '2020-05-01'], ['NFLX', '2019-01-09', 317.71, 323.351, 313.5, 319.96, 13343152.0, 0.0, 319.96, '2020-05-01'], ['NFLX', '2019-01-08', 319.98, 320.593, 308.01, 320.27, 15359180.0, 0.0, 320.27, '2020-05-01'], ['NFLX', '2019-01-07', 302.1, 316.8, 301.65, 315.34, 18620116.0, 0.0, 315.34, '2020-05-01'], ['NFLX', '2019-01-04', 281.88, 297.8, 278.54, 297.57, 19330102.0, 0.0, 297.57, '2020-05-01'], ['NFLX', '2019-01-03', 270.2, 275.79, 264.43, 271.2, 14969647.0, 0.0, 271.2, '2020-05-01'], ['NFLX', '2019-01-02', 259.28, 269.75, 256.58, 267.66, 11679528.0, 0.0, 267.66, '2020-05-01'], ['NFLX', '2018-12-31', 260.16, 270.1, 260.0, 267.66, 13508920.0, 0.0, 267.66, '2020-05-01'], ['NFLX', '2018-12-28', 257.94, 261.914, 249.8, 256.08, 10987286.0, 0.0, 256.08, '2020-05-01'], ['NFLX', '2018-12-27', 250.11, 255.59, 240.1, 255.565, 12235217.0, 0.0, 255.565, '2020-05-01'], ['NFLX', '2018-12-26', 233.92, 254.5, 231.23, 253.67, 14402735.0, 0.0, 253.67, '2020-05-01'], ['NFLX', '2018-12-24', 242.0, 250.65, 233.68, 233.88, 9547616.0, 0.0, 233.88, '2020-05-01'], ['NFLX', '2018-12-21', 263.83, 264.5, 241.29, 246.39, 21397595.0, 0.0, 246.39, '2020-05-01'], ['NFLX', '2018-12-20', 264.64, 269.9, 251.88, 260.58, 16792928.0, 0.0, 260.58, '2020-05-01'], ['NFLX', '2018-12-19', 269.96, 280.87, 263.77, 266.77, 13788448.0, 0.0, 266.77, '2020-05-01'], ['NFLX', '2018-12-18', 263.3, 275.75, 263.29, 270.94, 10350079.0, 0.0, 270.94, '2020-05-01'], ['NFLX', '2018-12-17', 266.51, 272.98, 261.075, 262.8, 9634734.0, 0.0, 262.8, '2020-05-01'], ['NFLX', '2018-12-14', 271.81, 277.666, 265.0, 266.84, 9915319.0, 0.0, 266.84, '2020-05-01'], ['NFLX', '2018-12-13', 277.64, 279.32, 271.85, 276.02, 8379292.0, 0.0, 276.02, '2020-05-01'], ['NFLX', '2018-12-12', 267.66, 281.769, 266.48, 274.88, 11456716.0, 0.0, 274.88, '2020-05-01'], ['NFLX', '2018-12-11', 274.08, 274.5, 262.76, 265.32, 9843199.0, 0.0, 265.32, '2020-05-01'], ['NFLX', '2018-12-10', 264.19, 271.18, 260.609, 269.7, 9605553.0, 0.0, 269.7, '2020-05-01'], ['NFLX', '2018-12-07', 282.48, 284.209, 263.38, 265.14, 12466711.0, 0.0, 265.14, '2020-05-01'], ['NFLX', '2018-12-06', 268.33, 283.22, 267.14, 282.88, 13074324.0, 0.0, 282.88, '2020-05-01'], ['NFLX', '2018-12-04', 288.13, 295.74, 274.72, 275.33, 12800586.0, 0.0, 275.33, '2020-05-01'], ['NFLX', '2018-12-03', 293.19, 298.72, 284.58, 290.3, 14117370.0, 0.0, 290.3, '2020-05-01'], ['NFLX', '2018-11-30', 288.0, 290.81, 283.061, 286.13, 11860117.0, 0.0, 286.13, '2020-05-01'], ['NFLX', '2018-11-29', 282.32, 290.49, 275.5, 288.75, 15431538.0, 0.0, 288.75, '2020-05-01'], ['NFLX', '2018-11-28', 271.98, 284.0, 263.34, 282.65, 14801333.0, 0.0, 282.65, '2020-05-01'], ['NFLX', '2018-11-27', 259.24, 269.08, 256.14, 266.63, 11149501.0, 0.0, 266.63, '2020-05-01'], ['NFLX', '2018-11-26', 260.55, 266.25, 253.8, 261.43, 12498560.0, 0.0, 261.43, '2020-05-01'], ['NFLX', '2018-11-23', 260.11, 265.5, 256.84, 258.82, 5245123.0, 0.0, 258.82, '2020-05-01'], ['NFLX', '2018-11-21', 274.42, 275.34, 261.51, 262.13, 11023037.0, 0.0, 262.13, '2020-05-01'], ['NFLX', '2018-11-20', 254.63, 276.34, 250.0, 266.98, 16693809.0, 0.0, 266.98, '2020-05-01'], ['NFLX', '2018-11-19', 283.79, 285.09, 269.15, 270.6, 12993797.0, 0.0, 270.6, '2020-05-01'], ['NFLX', '2018-11-16', 287.14, 291.72, 281.0, 286.21, 9099485.0, 0.0, 286.21, '2020-05-01'], ['NFLX', '2018-11-15', 285.51, 292.5, 282.16, 290.06, 9967098.0, 0.0, 290.06, '2020-05-01'], ['NFLX', '2018-11-14', 300.4, 301.84, 278.297, 286.73, 16853574.0, 0.0, 286.73, '2020-05-01'], ['NFLX', '2018-11-13', 295.0, 303.55, 289.1, 294.4, 12232162.0, 0.0, 294.4, '2020-05-01'], ['NFLX', '2018-11-12', 300.0, 302.49, 290.63, 294.07, 10924827.0, 0.0, 294.07, '2020-05-01'], ['NFLX', '2018-11-09', 311.07, 312.98, 298.01, 303.47, 13480792.0, 0.0, 303.47, '2020-05-01'], ['NFLX', '2018-11-08', 328.0, 332.05, 316.61, 317.92, 11023853.0, 0.0, 317.92, '2020-05-01'], ['NFLX', '2018-11-07', 312.9, 328.56, 311.0, 327.5, 13328328.0, 0.0, 327.5, '2020-05-01'], ['NFLX', '2018-11-06', 314.76, 320.22, 305.3, 310.84, 9710424.0, 0.0, 310.84, '2020-05-01'], ['NFLX', '2018-11-05', 311.1, 317.53, 303.74, 315.44, 10283044.0, 0.0, 315.44, '2020-05-01'], ['NFLX', '2018-11-02', 318.0, 321.88, 308.33, 309.1, 13404646.0, 0.0, 309.1, '2020-05-01'], ['NFLX', '2018-11-01', 304.59, 318.45, 296.67, 317.38, 15121450.0, 0.0, 317.38, '2020-05-01'], ['NFLX', '2018-10-31', 297.77, 311.5, 295.05, 301.78, 20360342.0, 0.0, 301.78, '2020-05-01'], ['NFLX', '2018-10-30', 275.57, 290.525, 271.209, 285.81, 23685702.0, 0.0, 285.81, '2020-05-01'], ['NFLX', '2018-10-29', 305.26, 307.89, 275.4, 284.84, 21698841.0, 0.0, 284.84, '2018-10-29'], ['NFLX', '2018-10-26', 300.51, 313.99, 292.3, 299.83, 19616041.0, 0.0, 299.83, '2020-05-01'], ['NFLX', '2018-10-25', 307.12, 319.94, 305.25, 312.87, 13346921.0, 0.0, 312.87, '2020-05-01'], ['NFLX', '2018-10-24', 332.28, 333.0, 300.73, 301.83, 19039297.0, 0.0, 301.83, '2020-05-01'], ['NFLX', '2018-10-23', 318.0, 336.58, 316.77, 333.16, 14907326.0, 0.0, 333.16, '2020-05-01'], ['NFLX', '2018-10-22', 333.1, 335.8, 320.34, 329.54, 17097175.0, 0.0, 329.54, '2020-05-01'], ['NFLX', '2018-10-19', 351.0, 355.8, 332.2, 332.67, 16717233.0, 0.0, 332.67, '2020-05-01'], ['NFLX', '2018-10-18', 360.673, 362.2, 346.05, 346.71, 18461040.0, 0.0, 346.71, '2020-05-01']], 'columns': [{'name': 'ticker', 'type': 'String'}, {'name': 'date', 'type': 'Date'}, {'name': 'open', 'type': 'double'}, {'name': 'high', 'type': 'double'}, {'name': 'low', 'type': 'double'}, {'name': 'close', 'type': 'double'}, {'name': 'volume', 'type': 'double'}, {'name': 'dividends', 'type': 'double'}, {'name': 'closeunadj', 'type': 'double'}, {'name': 'lastupdated', 'type': 'Date'}]}, 'meta': {'next_cursor_id': None}}
stock_quandl.columns = ['ticker', 'date', 'open', 'high', 'low', 'close', 'volume', 'dividend', 'closeunadj', 'lastupdated']
# stock_quandl.set_index('date', inplace=True)
stock_quandl.index = pd.to_datetime(stock_quandl.date)
stock_quandl = stock_quandl.sort_index(ascending = True)
stock_quandl.info(verbose=True)
<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 426 entries, 2018-10-18 to 2020-06-29 Data columns (total 10 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 ticker 426 non-null object 1 date 426 non-null object 2 open 426 non-null float64 3 high 426 non-null float64 4 low 426 non-null float64 5 close 426 non-null float64 6 volume 426 non-null float64 7 dividend 426 non-null float64 8 closeunadj 426 non-null float64 9 lastupdated 426 non-null object dtypes: float64(7), object(3) memory usage: 36.6+ KB
stock_quandl.head()
| ticker | date | open | high | low | close | volume | dividend | closeunadj | lastupdated | |
|---|---|---|---|---|---|---|---|---|---|---|
| date | ||||||||||
| 2018-10-18 | NFLX | 2018-10-18 | 360.673 | 362.20 | 346.05 | 346.71 | 18461040.0 | 0.0 | 346.71 | 2020-05-01 |
| 2018-10-19 | NFLX | 2018-10-19 | 351.000 | 355.80 | 332.20 | 332.67 | 16717233.0 | 0.0 | 332.67 | 2020-05-01 |
| 2018-10-22 | NFLX | 2018-10-22 | 333.100 | 335.80 | 320.34 | 329.54 | 17097175.0 | 0.0 | 329.54 | 2020-05-01 |
| 2018-10-23 | NFLX | 2018-10-23 | 318.000 | 336.58 | 316.77 | 333.16 | 14907326.0 | 0.0 | 333.16 | 2020-05-01 |
| 2018-10-24 | NFLX | 2018-10-24 | 332.280 | 333.00 | 300.73 | 301.83 | 19039297.0 | 0.0 | 301.83 | 2020-05-01 |
stock_quandl.tail()
| ticker | date | open | high | low | close | volume | dividend | closeunadj | lastupdated | |
|---|---|---|---|---|---|---|---|---|---|---|
| date | ||||||||||
| 2020-06-23 | NFLX | 2020-06-23 | 466.50 | 474.01 | 464.50 | 466.26 | 5948436.0 | 0.0 | 466.26 | 2020-06-25 |
| 2020-06-24 | NFLX | 2020-06-24 | 468.54 | 472.36 | 454.00 | 457.85 | 4804903.0 | 0.0 | 457.85 | 2020-06-24 |
| 2020-06-25 | NFLX | 2020-06-25 | 458.86 | 467.01 | 454.00 | 465.91 | 3938090.0 | 0.0 | 465.91 | 2020-06-25 |
| 2020-06-26 | NFLX | 2020-06-26 | 466.39 | 468.03 | 442.24 | 443.40 | 6804726.0 | 0.0 | 443.40 | 2020-06-26 |
| 2020-06-29 | NFLX | 2020-06-29 | 445.23 | 447.67 | 432.14 | 447.24 | 4816812.0 | 0.0 | 447.24 | 2020-06-29 |
title_string = 'Quandl Historical Stock Information for ' + stock_symbol
stock_quandl['close'].plot(figsize=(16,9), title=title_string)
plt.show()
# Select the data source and pricing columns to use for modeling
# trading_model = stock_yahoo.loc[:, ['Open','Adj Close']]
# trading_model = stock_alpha.loc[:, ['open','adj_close']]
model_template = stock_quandl.loc[:, ['open','close']]
# trading_model = stock_quandl.loc[start_date:end_date, ['Adj_Close']]
# Set up the standard column name for modeling
model_template.rename(columns={'open': 'open_price', 'close': 'close_price'}, inplace=True)
if verbose: model_template.info(verbose=True)
<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 426 entries, 2018-10-18 to 2020-06-29 Data columns (total 2 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 open_price 426 non-null float64 1 close_price 426 non-null float64 dtypes: float64(2) memory usage: 10.0 KB
if verbose: model_template.head()
if verbose: model_template.tail()
def trading_ma_crossover(model):
waitfor_first_entry = True
for x in range(len(model)):
if model['ma_change'].iloc[x] > 0:
model['trade_signal'].iloc[x] = 1 # trade_signal = 1 means we should take a long position
else:
model['trade_signal'].iloc[x] = 0 # trade_signal = 0 means we should take a flat position
if x != 0:
model['signal_change'].iloc[x] = model['trade_signal'].iloc[x] - model['trade_signal'].iloc[x-1]
if waitfor_first_entry and (model['signal_change'].iloc[x-1] == 1):
model['entry_exit'].iloc[x] = model['signal_change'].iloc[x-1]
waitfor_first_entry = False
elif (not waitfor_first_entry) and (model['signal_change'].iloc[x-1] != 0):
model['entry_exit'].iloc[x] = model['signal_change'].iloc[x-1]
model_collection = {}
serial_number = 1
for slow_ma in range(slow_ma_min, slow_ma_max+1, ma_increment):
for fast_ma in range(fast_ma_min, fast_ma_max+1, ma_increment):
if (slow_ma - fast_ma) < min_ma_gap: break
print('Processing model with slow_ma of', slow_ma, 'and fast_ma of', fast_ma)
model_name = 'EMA_' + str(serial_number).zfill(3) + '_SlowMA_' + str(slow_ma).zfill(2) + '_FastMA_' + str(fast_ma).zfill(2)
serial_number = serial_number + 1
trading_model = model_template.copy()
trading_model['fast_ma'] = trading_model['close_price'].ewm(span=fast_ma).mean()
trading_model['slow_ma'] = trading_model['close_price'].ewm(span=slow_ma).mean()
trading_model['ma_change'] = trading_model['fast_ma'] - trading_model['slow_ma']
trading_model['trade_signal'] = np.zeros(len(trading_model))
trading_model['signal_change'] = np.zeros(len(trading_model))
trading_model['entry_exit'] = np.zeros(len(trading_model))
trading_model = trading_model[model_start_date:model_end_date]
trading_ma_crossover(trading_model)
model_collection[model_name] = trading_model.copy()
print('Model', model_name, 'added to the trading model collection.')
Processing model with slow_ma of 10 and fast_ma of 5 Model EMA_001_SlowMA_10_FastMA_05 added to the trading model collection. Processing model with slow_ma of 15 and fast_ma of 5 Model EMA_002_SlowMA_15_FastMA_05 added to the trading model collection. Processing model with slow_ma of 15 and fast_ma of 10 Model EMA_003_SlowMA_15_FastMA_10 added to the trading model collection. Processing model with slow_ma of 20 and fast_ma of 5 Model EMA_004_SlowMA_20_FastMA_05 added to the trading model collection. Processing model with slow_ma of 20 and fast_ma of 10 Model EMA_005_SlowMA_20_FastMA_10 added to the trading model collection. Processing model with slow_ma of 20 and fast_ma of 15 Model EMA_006_SlowMA_20_FastMA_15 added to the trading model collection. Processing model with slow_ma of 25 and fast_ma of 5 Model EMA_007_SlowMA_25_FastMA_05 added to the trading model collection. Processing model with slow_ma of 25 and fast_ma of 10 Model EMA_008_SlowMA_25_FastMA_10 added to the trading model collection. Processing model with slow_ma of 25 and fast_ma of 15 Model EMA_009_SlowMA_25_FastMA_15 added to the trading model collection. Processing model with slow_ma of 25 and fast_ma of 20 Model EMA_010_SlowMA_25_FastMA_20 added to the trading model collection. Processing model with slow_ma of 30 and fast_ma of 5 Model EMA_011_SlowMA_30_FastMA_05 added to the trading model collection. Processing model with slow_ma of 30 and fast_ma of 10 Model EMA_012_SlowMA_30_FastMA_10 added to the trading model collection. Processing model with slow_ma of 30 and fast_ma of 15 Model EMA_013_SlowMA_30_FastMA_15 added to the trading model collection. Processing model with slow_ma of 30 and fast_ma of 20 Model EMA_014_SlowMA_30_FastMA_20 added to the trading model collection. Processing model with slow_ma of 35 and fast_ma of 5 Model EMA_015_SlowMA_35_FastMA_05 added to the trading model collection. Processing model with slow_ma of 35 and fast_ma of 10 Model EMA_016_SlowMA_35_FastMA_10 added to the trading model collection. Processing model with slow_ma of 35 and fast_ma of 15 Model EMA_017_SlowMA_35_FastMA_15 added to the trading model collection. Processing model with slow_ma of 35 and fast_ma of 20 Model EMA_018_SlowMA_35_FastMA_20 added to the trading model collection. Processing model with slow_ma of 40 and fast_ma of 5 Model EMA_019_SlowMA_40_FastMA_05 added to the trading model collection. Processing model with slow_ma of 40 and fast_ma of 10 Model EMA_020_SlowMA_40_FastMA_10 added to the trading model collection. Processing model with slow_ma of 40 and fast_ma of 15 Model EMA_021_SlowMA_40_FastMA_15 added to the trading model collection. Processing model with slow_ma of 40 and fast_ma of 20 Model EMA_022_SlowMA_40_FastMA_20 added to the trading model collection. Processing model with slow_ma of 45 and fast_ma of 5 Model EMA_023_SlowMA_45_FastMA_05 added to the trading model collection. Processing model with slow_ma of 45 and fast_ma of 10 Model EMA_024_SlowMA_45_FastMA_10 added to the trading model collection. Processing model with slow_ma of 45 and fast_ma of 15 Model EMA_025_SlowMA_45_FastMA_15 added to the trading model collection. Processing model with slow_ma of 45 and fast_ma of 20 Model EMA_026_SlowMA_45_FastMA_20 added to the trading model collection. Processing model with slow_ma of 50 and fast_ma of 5 Model EMA_027_SlowMA_50_FastMA_05 added to the trading model collection. Processing model with slow_ma of 50 and fast_ma of 10 Model EMA_028_SlowMA_50_FastMA_10 added to the trading model collection. Processing model with slow_ma of 50 and fast_ma of 15 Model EMA_029_SlowMA_50_FastMA_15 added to the trading model collection. Processing model with slow_ma of 50 and fast_ma of 20 Model EMA_030_SlowMA_50_FastMA_20 added to the trading model collection.
# List the entry/exit points for each model
for key in model_collection:
print('List the signal change and entry/exit points for', key)
if verbose: print(model_collection[key][(model_collection[key].signal_change != 0) | (model_collection[key].entry_exit != 0)])
else: print(model_collection[key][model_collection[key].entry_exit != 0])
print()
List the signal change and entry/exit points for EMA_001_SlowMA_10_FastMA_05
open_price close_price fast_ma slow_ma ma_change \
date
2019-03-04 359.720 351.04 356.875358 357.609596 -0.734238
2019-03-13 355.810 361.21 357.524351 356.964175 0.560176
2019-03-14 360.500 358.82 357.956234 357.301598 0.654636
2019-03-27 361.000 353.37 360.648004 361.816467 -1.168463
2019-03-28 354.485 354.61 358.635336 360.506201 -1.870865
2019-04-02 366.250 367.72 363.206025 362.297566 0.908460
2019-04-03 369.260 369.75 365.387350 363.652554 1.734796
2019-04-12 360.690 351.14 360.672328 362.280410 -1.608082
2019-04-15 350.710 348.87 356.738219 359.842154 -3.103935
2019-04-22 359.700 377.34 364.380883 362.440073 1.940810
2019-04-23 375.450 381.89 370.217255 365.976423 4.240832
2019-05-08 367.920 364.37 372.104776 372.821425 -0.716648
2019-05-09 360.900 362.75 368.986518 370.990257 -2.003739
2019-06-06 354.840 357.13 352.714875 352.158132 0.556744
2019-06-07 357.390 360.87 355.433250 353.742108 1.691143
2019-06-12 351.820 345.56 350.709852 351.675880 -0.966028
2019-06-13 347.230 343.43 348.283235 350.176629 -1.893395
2019-06-18 355.570 357.12 350.480958 350.233526 0.247433
2019-06-19 361.720 363.52 354.827306 352.649248 2.178057
2019-07-15 372.940 366.60 373.585520 373.844934 -0.259414
2019-07-16 370.090 365.99 371.053680 372.416764 -1.363085
2019-09-17 294.500 298.60 294.352418 293.427403 0.925015
2019-09-18 294.990 291.56 293.421612 293.087875 0.333737
2019-09-19 291.560 286.60 291.147741 291.908262 -0.760520
2019-09-20 280.260 270.75 284.348494 288.061305 -3.712811
2019-10-10 265.970 280.48 273.380971 272.266753 1.114217
2019-10-11 284.800 282.93 276.563980 274.205525 2.358455
2019-10-22 271.159 266.69 276.313004 277.721714 -1.408710
2019-10-23 268.060 271.27 274.632003 276.548675 -1.916673
2019-10-28 278.050 281.86 277.063556 276.940244 0.123313
2019-10-29 281.870 281.21 278.445704 277.716563 0.729141
2019-12-05 305.270 302.86 306.383809 306.723736 -0.339928
2019-12-06 304.700 307.35 306.705872 306.837602 -0.131730
2019-12-17 307.360 315.48 305.812442 304.371674 1.440768
2019-12-18 316.260 320.80 310.808295 307.358642 3.449653
2020-01-22 332.550 326.00 334.131301 334.487170 -0.355869
2020-01-23 326.040 349.60 339.287534 337.234957 2.052577
2020-01-24 348.460 353.16 343.911689 340.130419 3.781270
2020-02-25 372.000 360.09 371.952954 373.603776 -1.650822
2020-02-26 366.310 379.24 374.381969 374.628544 -0.246575
2020-03-02 373.110 381.05 375.019472 374.608015 0.411457
2020-03-03 381.030 368.77 372.936315 373.546558 -0.610243
2020-03-04 377.770 383.79 376.554210 375.409002 1.145208
2020-03-05 381.000 372.78 375.296140 374.931002 0.365138
2020-03-06 367.700 368.97 373.187427 373.847183 -0.659757
2020-03-09 343.860 346.49 364.288284 368.873150 -4.584865
2020-03-23 347.890 360.27 338.587961 338.470149 0.117812
2020-03-24 369.990 357.32 344.831974 341.897395 2.934579
2020-05-22 437.000 429.32 439.058486 439.462560 -0.404074
2020-05-26 427.770 414.77 430.962324 434.973004 -4.010679
2020-06-09 421.650 434.05 424.673134 424.594042 0.079092
2020-06-10 436.000 434.48 427.942090 426.391489 1.550600
2020-06-12 429.000 418.07 424.122040 424.754799 -0.632759
2020-06-15 421.400 425.50 424.581360 424.890290 -0.308930
2020-06-16 425.760 436.13 428.430907 426.933873 1.497033
2020-06-17 441.820 447.77 434.877271 430.722260 4.155011
trade_signal signal_change entry_exit
date
2019-03-04 0.0 -1.0 0.0
2019-03-13 1.0 1.0 0.0
2019-03-14 1.0 0.0 1.0
2019-03-27 0.0 -1.0 0.0
2019-03-28 0.0 0.0 -1.0
2019-04-02 1.0 1.0 0.0
2019-04-03 1.0 0.0 1.0
2019-04-12 0.0 -1.0 0.0
2019-04-15 0.0 0.0 -1.0
2019-04-22 1.0 1.0 0.0
2019-04-23 1.0 0.0 1.0
2019-05-08 0.0 -1.0 0.0
2019-05-09 0.0 0.0 -1.0
2019-06-06 1.0 1.0 0.0
2019-06-07 1.0 0.0 1.0
2019-06-12 0.0 -1.0 0.0
2019-06-13 0.0 0.0 -1.0
2019-06-18 1.0 1.0 0.0
2019-06-19 1.0 0.0 1.0
2019-07-15 0.0 -1.0 0.0
2019-07-16 0.0 0.0 -1.0
2019-09-17 1.0 1.0 0.0
2019-09-18 1.0 0.0 1.0
2019-09-19 0.0 -1.0 0.0
2019-09-20 0.0 0.0 -1.0
2019-10-10 1.0 1.0 0.0
2019-10-11 1.0 0.0 1.0
2019-10-22 0.0 -1.0 0.0
2019-10-23 0.0 0.0 -1.0
2019-10-28 1.0 1.0 0.0
2019-10-29 1.0 0.0 1.0
2019-12-05 0.0 -1.0 0.0
2019-12-06 0.0 0.0 -1.0
2019-12-17 1.0 1.0 0.0
2019-12-18 1.0 0.0 1.0
2020-01-22 0.0 -1.0 0.0
2020-01-23 1.0 1.0 -1.0
2020-01-24 1.0 0.0 1.0
2020-02-25 0.0 -1.0 0.0
2020-02-26 0.0 0.0 -1.0
2020-03-02 1.0 1.0 0.0
2020-03-03 0.0 -1.0 1.0
2020-03-04 1.0 1.0 -1.0
2020-03-05 1.0 0.0 1.0
2020-03-06 0.0 -1.0 0.0
2020-03-09 0.0 0.0 -1.0
2020-03-23 1.0 1.0 0.0
2020-03-24 1.0 0.0 1.0
2020-05-22 0.0 -1.0 0.0
2020-05-26 0.0 0.0 -1.0
2020-06-09 1.0 1.0 0.0
2020-06-10 1.0 0.0 1.0
2020-06-12 0.0 -1.0 0.0
2020-06-15 0.0 0.0 -1.0
2020-06-16 1.0 1.0 0.0
2020-06-17 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_002_SlowMA_15_FastMA_05
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-03 270.200 271.20 264.811004 263.592293 1.218711
2019-01-04 281.880 297.57 275.730669 267.843095 7.887575
2019-03-07 360.160 352.60 355.676402 355.822236 -0.145833
2019-03-08 345.750 349.60 353.650935 355.044454 -1.393519
2019-03-12 359.370 356.27 355.681527 355.614974 0.066553
2019-03-13 355.810 361.21 357.524351 356.314353 1.209998
2019-03-27 361.000 353.37 360.648004 361.283148 -0.635144
2019-03-28 354.485 354.61 358.635336 360.449004 -1.813668
2019-04-01 359.000 366.96 360.949038 360.837519 0.111520
2019-04-02 366.250 367.72 363.206025 361.697829 1.508196
2019-04-12 360.690 351.14 360.672328 362.458141 -1.785813
2019-04-15 350.710 348.87 356.738219 360.759623 -4.021404
2019-04-22 359.700 377.34 364.380883 362.102440 2.278443
2019-04-23 375.450 381.89 370.217255 364.575885 5.641370
2019-05-09 360.900 362.75 368.986518 370.686082 -1.699564
2019-05-10 361.620 361.04 366.337678 369.480321 -3.142643
2019-06-07 357.390 360.87 355.433250 354.161033 1.272217
2019-06-10 363.650 352.01 354.292167 353.892154 0.400013
2019-06-11 355.000 351.27 353.284778 353.564385 -0.279607
2019-06-12 351.820 345.56 350.709852 352.563837 -1.853985
2019-06-19 361.720 363.52 354.827306 352.501687 2.325619
2019-06-20 365.910 365.21 358.288204 354.090226 4.197978
2019-07-16 370.090 365.99 371.053680 371.325097 -0.271418
2019-07-17 366.250 362.44 368.182453 370.214460 -2.032007
2019-09-17 294.500 298.60 294.352418 294.251035 0.101382
2019-09-18 294.990 291.56 293.421612 293.914656 -0.493044
2019-09-19 291.560 286.60 291.147741 293.000324 -1.852583
2019-10-10 265.970 280.48 273.380971 273.343683 0.037287
2019-10-11 284.800 282.93 276.563980 274.541973 2.022007
2019-10-22 271.159 266.69 276.313004 277.690617 -1.377613
2019-10-23 268.060 271.27 274.632003 276.888039 -2.256037
2019-10-28 278.050 281.86 277.063556 276.986441 0.077116
2019-10-29 281.870 281.21 278.445704 277.514385 0.931319
2019-12-10 296.120 293.12 301.242610 303.409584 -2.166974
2019-12-11 294.490 298.93 300.471740 302.849636 -2.377896
2019-12-17 307.360 315.48 305.812442 303.791684 2.020759
2019-12-18 316.260 320.80 310.808295 305.917723 4.890572
2020-03-09 343.860 346.49 364.288284 369.779593 -5.491309
2020-03-10 356.425 364.13 364.235523 369.073394 -4.837871
2020-03-24 369.990 357.32 344.831974 344.400106 0.431868
2020-03-25 361.020 342.39 344.017983 344.148843 -0.130860
2020-03-26 344.000 362.99 350.341988 346.503988 3.838001
2020-03-27 359.090 357.12 352.601326 347.830989 4.770336
2020-05-26 427.770 414.77 430.962324 433.967021 -3.004697
2020-05-27 410.380 419.89 427.271550 432.207393 -4.935844
2020-06-10 436.000 434.48 427.942090 426.629274 1.312815
2020-06-11 428.200 425.56 427.148060 426.495615 0.652445
2020-06-12 429.000 418.07 424.122040 425.442413 -1.320373
2020-06-15 421.400 425.50 424.581360 425.449611 -0.868252
2020-06-16 425.760 436.13 428.430907 426.784660 1.646247
2020-06-17 441.820 447.77 434.877271 429.407828 5.469444
trade_signal signal_change entry_exit
date
2019-01-03 1.0 1.0 0.0
2019-01-04 1.0 0.0 1.0
2019-03-07 0.0 -1.0 0.0
2019-03-08 0.0 0.0 -1.0
2019-03-12 1.0 1.0 0.0
2019-03-13 1.0 0.0 1.0
2019-03-27 0.0 -1.0 0.0
2019-03-28 0.0 0.0 -1.0
2019-04-01 1.0 1.0 0.0
2019-04-02 1.0 0.0 1.0
2019-04-12 0.0 -1.0 0.0
2019-04-15 0.0 0.0 -1.0
2019-04-22 1.0 1.0 0.0
2019-04-23 1.0 0.0 1.0
2019-05-09 0.0 -1.0 0.0
2019-05-10 0.0 0.0 -1.0
2019-06-07 1.0 1.0 0.0
2019-06-10 1.0 0.0 1.0
2019-06-11 0.0 -1.0 0.0
2019-06-12 0.0 0.0 -1.0
2019-06-19 1.0 1.0 0.0
2019-06-20 1.0 0.0 1.0
2019-07-16 0.0 -1.0 0.0
2019-07-17 0.0 0.0 -1.0
2019-09-17 1.0 1.0 0.0
2019-09-18 0.0 -1.0 1.0
2019-09-19 0.0 0.0 -1.0
2019-10-10 1.0 1.0 0.0
2019-10-11 1.0 0.0 1.0
2019-10-22 0.0 -1.0 0.0
2019-10-23 0.0 0.0 -1.0
2019-10-28 1.0 1.0 0.0
2019-10-29 1.0 0.0 1.0
2019-12-10 0.0 -1.0 0.0
2019-12-11 0.0 0.0 -1.0
2019-12-17 1.0 1.0 0.0
2019-12-18 1.0 0.0 1.0
2020-03-09 0.0 -1.0 0.0
2020-03-10 0.0 0.0 -1.0
2020-03-24 1.0 1.0 0.0
2020-03-25 0.0 -1.0 1.0
2020-03-26 1.0 1.0 -1.0
2020-03-27 1.0 0.0 1.0
2020-05-26 0.0 -1.0 0.0
2020-05-27 0.0 0.0 -1.0
2020-06-10 1.0 1.0 0.0
2020-06-11 1.0 0.0 1.0
2020-06-12 0.0 -1.0 0.0
2020-06-15 0.0 0.0 -1.0
2020-06-16 1.0 1.0 0.0
2020-06-17 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_003_SlowMA_15_FastMA_10
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-04 281.880 297.57 268.997896 267.843095 1.154801
2019-01-07 302.100 315.34 277.423898 273.784597 3.639302
2019-03-29 357.160 356.56 359.788710 359.962878 -0.174169
2019-04-01 359.000 366.96 361.092581 360.837519 0.255062
2019-04-02 366.250 367.72 362.297566 361.697829 0.599737
2019-04-12 360.690 351.14 362.280410 362.458141 -0.177730
2019-04-15 350.710 348.87 359.842154 360.759623 -0.917469
2019-04-22 359.700 377.34 362.440073 362.102440 0.337633
2019-04-23 375.450 381.89 365.976423 364.575885 1.400538
2019-05-10 361.620 361.04 369.181119 369.480321 -0.299202
2019-05-13 352.290 345.26 364.831825 366.452781 -1.620957
2019-06-19 361.720 363.52 352.649248 352.501687 0.147561
2019-06-20 365.910 365.21 354.933021 354.090226 0.842795
2019-07-18 323.760 325.21 362.349569 364.588903 -2.239333
2019-07-19 323.400 315.10 353.758739 358.402790 -4.644051
2019-10-14 283.930 285.53 276.264521 275.915476 0.349044
2019-10-15 283.820 284.25 277.716426 276.957292 0.759134
2019-10-23 268.060 271.27 276.548675 276.888039 -0.339364
2019-10-24 271.810 271.50 275.630734 276.214535 -0.583800
2019-10-29 281.870 281.21 277.716563 277.514385 0.202177
2019-10-30 284.340 291.45 280.213551 279.256337 0.957214
2019-12-11 294.490 298.93 302.831279 302.849636 -0.018357
2019-12-12 295.670 298.44 302.032864 302.298431 -0.265567
2019-12-17 307.360 315.48 304.371674 303.791684 0.579991
2019-12-18 316.260 320.80 307.358642 305.917723 1.440919
2020-03-09 343.860 346.49 368.873150 369.779593 -0.906443
2020-03-10 356.425 364.13 368.010759 369.073394 -1.062635
2020-03-27 359.090 357.12 347.862840 347.830989 0.031851
2020-03-30 363.000 370.96 352.062324 350.722116 1.340209
2020-05-28 417.240 413.44 428.814160 429.861469 -1.047310
2020-05-29 417.460 419.73 427.162494 428.595036 -1.432541
2020-06-16 425.760 436.13 426.933873 426.784660 0.149213
2020-06-17 441.820 447.77 430.722260 429.407828 1.314433
trade_signal signal_change entry_exit
date
2019-01-04 1.0 1.0 0.0
2019-01-07 1.0 0.0 1.0
2019-03-29 0.0 -1.0 0.0
2019-04-01 1.0 1.0 -1.0
2019-04-02 1.0 0.0 1.0
2019-04-12 0.0 -1.0 0.0
2019-04-15 0.0 0.0 -1.0
2019-04-22 1.0 1.0 0.0
2019-04-23 1.0 0.0 1.0
2019-05-10 0.0 -1.0 0.0
2019-05-13 0.0 0.0 -1.0
2019-06-19 1.0 1.0 0.0
2019-06-20 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-10-14 1.0 1.0 0.0
2019-10-15 1.0 0.0 1.0
2019-10-23 0.0 -1.0 0.0
2019-10-24 0.0 0.0 -1.0
2019-10-29 1.0 1.0 0.0
2019-10-30 1.0 0.0 1.0
2019-12-11 0.0 -1.0 0.0
2019-12-12 0.0 0.0 -1.0
2019-12-17 1.0 1.0 0.0
2019-12-18 1.0 0.0 1.0
2020-03-09 0.0 -1.0 0.0
2020-03-10 0.0 0.0 -1.0
2020-03-27 1.0 1.0 0.0
2020-03-30 1.0 0.0 1.0
2020-05-28 0.0 -1.0 0.0
2020-05-29 0.0 0.0 -1.0
2020-06-16 1.0 1.0 0.0
2020-06-17 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_004_SlowMA_20_FastMA_05
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-04 281.880 297.57 275.730669 268.432540 7.298129
2019-01-07 302.100 315.34 288.933780 272.920094 16.013685
2019-03-28 354.485 354.61 358.635336 359.645334 -1.009998
2019-03-29 357.160 356.56 357.943557 359.351488 -1.407931
2019-04-01 359.000 366.96 360.949038 360.076118 0.872920
2019-04-02 366.250 367.72 363.206025 360.804116 2.401910
2019-04-12 360.690 351.14 360.672328 362.093778 -1.421450
2019-04-15 350.710 348.87 356.738219 360.834364 -4.096146
2019-04-22 359.700 377.34 364.380883 361.792529 2.588354
2019-04-23 375.450 381.89 370.217255 363.706579 6.510676
2019-05-09 360.900 362.75 368.986518 369.887702 -0.901184
2019-05-10 361.620 361.04 366.337678 369.045063 -2.707384
2019-06-07 357.390 360.87 355.433250 355.077473 0.355777
2019-06-10 363.650 352.01 354.292167 354.785333 -0.493166
2019-06-11 355.000 351.27 353.284778 354.450539 -1.165761
2019-06-19 361.720 363.52 354.827306 352.990688 1.836618
2019-06-20 365.910 365.21 358.288204 354.154432 4.133772
2019-07-17 366.250 362.44 368.182453 369.116203 -0.933750
2019-07-18 323.760 325.21 353.858302 364.934660 -11.076358
2019-10-11 284.800 282.93 276.563980 276.048035 0.515946
2019-10-14 283.930 285.53 279.552654 276.951079 2.601575
2019-10-22 271.159 266.69 276.313004 278.113331 -1.800327
2019-10-23 268.060 271.27 274.632003 277.461585 -2.829583
2019-10-29 281.870 281.21 278.445704 277.727051 0.718653
2019-10-30 284.340 291.45 282.780469 279.033998 3.746471
2019-12-10 296.120 293.12 301.242610 302.155312 -0.912702
2019-12-11 294.490 298.93 300.471740 301.848140 -1.376400
2019-12-17 307.360 315.48 305.812442 302.848505 2.963938
2019-12-18 316.260 320.80 310.808295 304.558171 6.250124
2020-03-09 343.860 346.49 364.288284 368.983998 -4.695714
2020-03-10 356.425 364.13 364.235523 368.521713 -4.286190
2020-03-26 344.000 362.99 350.341988 348.145331 2.196658
2020-03-27 359.090 357.12 352.601326 349.000061 3.601264
2020-05-26 427.770 414.77 430.962324 431.181487 -0.219162
2020-05-27 410.380 419.89 427.271550 430.106107 -2.834558
2020-06-10 436.000 434.48 427.942090 426.384692 1.557397
2020-06-11 428.200 425.56 427.148060 426.306150 0.841910
2020-06-12 429.000 418.07 424.122040 425.521755 -1.399715
2020-06-15 421.400 425.50 424.581360 425.519683 -0.938323
2020-06-16 425.760 436.13 428.430907 426.530189 1.900717
2020-06-17 441.820 447.77 434.877271 428.553028 6.324243
trade_signal signal_change entry_exit
date
2019-01-04 1.0 1.0 0.0
2019-01-07 1.0 0.0 1.0
2019-03-28 0.0 -1.0 0.0
2019-03-29 0.0 0.0 -1.0
2019-04-01 1.0 1.0 0.0
2019-04-02 1.0 0.0 1.0
2019-04-12 0.0 -1.0 0.0
2019-04-15 0.0 0.0 -1.0
2019-04-22 1.0 1.0 0.0
2019-04-23 1.0 0.0 1.0
2019-05-09 0.0 -1.0 0.0
2019-05-10 0.0 0.0 -1.0
2019-06-07 1.0 1.0 0.0
2019-06-10 0.0 -1.0 1.0
2019-06-11 0.0 0.0 -1.0
2019-06-19 1.0 1.0 0.0
2019-06-20 1.0 0.0 1.0
2019-07-17 0.0 -1.0 0.0
2019-07-18 0.0 0.0 -1.0
2019-10-11 1.0 1.0 0.0
2019-10-14 1.0 0.0 1.0
2019-10-22 0.0 -1.0 0.0
2019-10-23 0.0 0.0 -1.0
2019-10-29 1.0 1.0 0.0
2019-10-30 1.0 0.0 1.0
2019-12-10 0.0 -1.0 0.0
2019-12-11 0.0 0.0 -1.0
2019-12-17 1.0 1.0 0.0
2019-12-18 1.0 0.0 1.0
2020-03-09 0.0 -1.0 0.0
2020-03-10 0.0 0.0 -1.0
2020-03-26 1.0 1.0 0.0
2020-03-27 1.0 0.0 1.0
2020-05-26 0.0 -1.0 0.0
2020-05-27 0.0 0.0 -1.0
2020-06-10 1.0 1.0 0.0
2020-06-11 1.0 0.0 1.0
2020-06-12 0.0 -1.0 0.0
2020-06-15 0.0 0.0 -1.0
2020-06-16 1.0 1.0 0.0
2020-06-17 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_005_SlowMA_20_FastMA_10
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-04 281.880 297.57 268.997896 268.432540 0.565355
2019-01-07 302.100 315.34 277.423898 272.920094 4.503804
2019-04-15 350.710 348.87 359.842154 360.834364 -0.992211
2019-04-16 355.000 359.46 359.772671 360.703472 -0.930801
2019-04-22 359.700 377.34 362.440073 361.792529 0.647545
2019-04-23 375.450 381.89 365.976423 363.706579 2.269844
2019-05-13 352.290 345.26 364.831825 366.779817 -1.947992
2019-05-14 348.710 345.61 361.336947 364.763642 -3.426695
2019-06-20 365.910 365.21 354.933021 354.154432 0.778590
2019-06-21 365.000 369.21 357.528836 355.588295 1.940540
2019-07-18 323.760 325.21 362.349569 364.934660 -2.585090
2019-07-19 323.400 315.10 353.758739 360.188502 -6.429763
2019-10-15 283.820 284.25 277.716426 277.646214 0.070212
2019-10-16 283.120 286.28 279.273440 278.468480 0.804960
2019-10-22 271.159 266.69 277.721714 278.113331 -0.391617
2019-10-23 268.060 271.27 276.548675 277.461585 -0.912910
2019-10-30 284.340 291.45 280.213551 279.033998 1.179553
2019-10-31 291.000 287.41 281.521997 279.831713 1.690284
2020-03-09 343.860 346.49 368.873150 368.983998 -0.110848
2020-03-10 356.425 364.13 368.010759 368.521713 -0.510954
2020-03-30 363.000 370.96 352.062324 351.091484 0.970840
2020-03-31 367.930 375.50 356.323720 353.416104 2.907615
2020-05-29 417.460 419.73 427.162494 427.681825 -0.519330
2020-06-01 418.830 425.92 426.936586 427.514032 -0.577446
2020-06-10 436.000 434.48 426.391489 426.384692 0.006797
2020-06-11 428.200 425.56 426.240309 426.306150 -0.065841
2020-06-12 429.000 418.07 424.754799 425.521755 -0.766956
2020-06-16 425.760 436.13 426.933873 426.530189 0.403684
2020-06-17 441.820 447.77 430.722260 428.553028 2.169232
trade_signal signal_change entry_exit
date
2019-01-04 1.0 1.0 0.0
2019-01-07 1.0 0.0 1.0
2019-04-15 0.0 -1.0 0.0
2019-04-16 0.0 0.0 -1.0
2019-04-22 1.0 1.0 0.0
2019-04-23 1.0 0.0 1.0
2019-05-13 0.0 -1.0 0.0
2019-05-14 0.0 0.0 -1.0
2019-06-20 1.0 1.0 0.0
2019-06-21 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-10-15 1.0 1.0 0.0
2019-10-16 1.0 0.0 1.0
2019-10-22 0.0 -1.0 0.0
2019-10-23 0.0 0.0 -1.0
2019-10-30 1.0 1.0 0.0
2019-10-31 1.0 0.0 1.0
2020-03-09 0.0 -1.0 0.0
2020-03-10 0.0 0.0 -1.0
2020-03-30 1.0 1.0 0.0
2020-03-31 1.0 0.0 1.0
2020-05-29 0.0 -1.0 0.0
2020-06-01 0.0 0.0 -1.0
2020-06-10 1.0 1.0 0.0
2020-06-11 0.0 -1.0 1.0
2020-06-12 0.0 0.0 -1.0
2020-06-16 1.0 1.0 0.0
2020-06-17 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_006_SlowMA_20_FastMA_15
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-07 302.10 315.34 273.784597 272.920094 0.864502
2019-01-08 319.98 320.27 279.599030 277.448029 2.151001
2019-04-15 350.71 348.87 360.759623 360.834364 -0.074742
2019-04-16 355.00 359.46 360.597170 360.703472 -0.106302
2019-04-22 359.70 377.34 362.102440 361.792529 0.309911
2019-04-23 375.45 381.89 364.575885 363.706579 0.869306
2019-05-13 352.29 345.26 366.452781 366.779817 -0.327036
2019-05-14 348.71 345.61 363.847434 364.763642 -0.916209
2019-06-21 365.00 369.21 355.980198 355.588295 0.391902
2019-06-24 370.27 371.04 357.862673 357.059886 0.802787
2019-07-18 323.76 325.21 364.588903 364.934660 -0.345757
2019-07-19 323.40 315.10 358.402790 360.188502 -1.785712
2019-10-17 304.49 293.35 280.026052 279.885767 0.140284
2019-10-18 289.36 275.30 279.435295 279.449028 -0.013733
2019-10-21 272.89 278.05 279.262133 279.315787 -0.053654
2019-10-30 284.34 291.45 279.256337 279.033998 0.222339
2019-10-31 291.00 287.41 280.275545 279.831713 0.443832
2020-03-11 358.92 349.92 366.679220 366.750121 -0.070901
2020-03-12 326.50 315.25 360.250567 361.845347 -1.594780
2020-03-31 367.93 375.50 353.819351 353.416104 0.403247
2020-04-01 376.05 364.08 355.101932 354.431714 0.670219
2020-06-04 422.39 414.33 425.740303 425.764786 -0.024483
2020-06-05 407.29 419.60 424.972765 425.177664 -0.204899
2020-06-10 436.00 434.48 426.629274 426.384692 0.244582
2020-06-11 428.20 425.56 426.495615 426.306150 0.189465
2020-06-12 429.00 418.07 425.442413 425.521755 -0.079342
2020-06-15 421.40 425.50 425.449611 425.519683 -0.070072
2020-06-16 425.76 436.13 426.784660 426.530189 0.254471
2020-06-17 441.82 447.77 429.407828 428.553028 0.854799
trade_signal signal_change entry_exit
date
2019-01-07 1.0 1.0 0.0
2019-01-08 1.0 0.0 1.0
2019-04-15 0.0 -1.0 0.0
2019-04-16 0.0 0.0 -1.0
2019-04-22 1.0 1.0 0.0
2019-04-23 1.0 0.0 1.0
2019-05-13 0.0 -1.0 0.0
2019-05-14 0.0 0.0 -1.0
2019-06-21 1.0 1.0 0.0
2019-06-24 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-10-17 1.0 1.0 0.0
2019-10-18 0.0 -1.0 1.0
2019-10-21 0.0 0.0 -1.0
2019-10-30 1.0 1.0 0.0
2019-10-31 1.0 0.0 1.0
2020-03-11 0.0 -1.0 0.0
2020-03-12 0.0 0.0 -1.0
2020-03-31 1.0 1.0 0.0
2020-04-01 1.0 0.0 1.0
2020-06-04 0.0 -1.0 0.0
2020-06-05 0.0 0.0 -1.0
2020-06-10 1.0 1.0 0.0
2020-06-11 1.0 0.0 1.0
2020-06-12 0.0 -1.0 0.0
2020-06-15 0.0 0.0 -1.0
2020-06-16 1.0 1.0 0.0
2020-06-17 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_007_SlowMA_25_FastMA_05
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-04 281.880 297.57 275.730669 269.577824 6.152845
2019-01-07 302.100 315.34 288.933780 273.145330 15.788450
2019-03-29 357.160 356.56 357.943557 358.173955 -0.230398
2019-04-01 359.000 366.96 360.949038 358.849891 2.099147
2019-04-02 366.250 367.72 363.206025 359.532288 3.673737
2019-04-12 360.690 351.14 360.672328 361.322156 -0.649828
2019-04-15 350.710 348.87 356.738219 360.364242 -3.626024
2019-04-22 359.700 377.34 364.380883 361.245752 3.135131
2019-04-23 375.450 381.89 370.217255 362.833832 7.383423
2019-05-10 361.620 361.04 366.337678 368.329729 -1.992051
2019-05-13 352.290 345.26 359.311786 366.555112 -7.243327
2019-06-19 361.720 363.52 354.827306 353.663931 1.163375
2019-06-20 365.910 365.21 358.288204 354.552091 3.736113
2019-07-18 323.760 325.21 353.858302 364.708289 -10.849987
2019-07-19 323.400 315.10 340.938868 360.892266 -19.953398
2019-10-14 283.930 285.53 279.552654 278.697875 0.854778
2019-10-15 283.820 284.25 281.118436 279.124962 1.993474
2019-10-22 271.159 266.69 276.313004 279.101634 -2.788630
2019-10-23 268.060 271.27 274.632003 278.499201 -3.867198
2019-10-29 281.870 281.21 278.445704 278.412833 0.032871
2019-10-30 284.340 291.45 282.780469 279.415692 3.364778
2019-12-11 294.490 298.93 300.471740 300.561998 -0.090258
2019-12-12 295.670 298.44 299.794493 300.398767 -0.604274
2019-12-16 300.850 304.21 300.978664 300.557115 0.421548
2019-12-17 307.360 315.48 305.812442 301.705030 4.107413
2020-03-09 343.860 346.49 364.288284 367.301480 -3.013195
2020-03-10 356.425 364.13 364.235523 367.057520 -2.821997
2020-03-26 344.000 362.99 350.341988 349.440172 0.901816
2020-03-27 359.090 357.12 352.601326 350.030928 2.570398
2020-05-28 417.240 413.44 422.661033 426.021552 -3.360519
2020-05-29 417.460 419.73 421.684022 425.537587 -3.853565
2020-06-09 421.650 434.05 424.673134 424.606045 0.067090
2020-06-10 436.000 434.48 427.942090 425.365580 2.576510
2020-06-12 429.000 418.07 424.122040 424.818186 -0.696146
2020-06-15 421.400 425.50 424.581360 424.870633 -0.289274
2020-06-16 425.760 436.13 428.430907 425.736739 2.694168
2020-06-17 441.820 447.77 434.877271 427.431605 7.445666
trade_signal signal_change entry_exit
date
2019-01-04 1.0 1.0 0.0
2019-01-07 1.0 0.0 1.0
2019-03-29 0.0 -1.0 0.0
2019-04-01 1.0 1.0 -1.0
2019-04-02 1.0 0.0 1.0
2019-04-12 0.0 -1.0 0.0
2019-04-15 0.0 0.0 -1.0
2019-04-22 1.0 1.0 0.0
2019-04-23 1.0 0.0 1.0
2019-05-10 0.0 -1.0 0.0
2019-05-13 0.0 0.0 -1.0
2019-06-19 1.0 1.0 0.0
2019-06-20 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-10-14 1.0 1.0 0.0
2019-10-15 1.0 0.0 1.0
2019-10-22 0.0 -1.0 0.0
2019-10-23 0.0 0.0 -1.0
2019-10-29 1.0 1.0 0.0
2019-10-30 1.0 0.0 1.0
2019-12-11 0.0 -1.0 0.0
2019-12-12 0.0 0.0 -1.0
2019-12-16 1.0 1.0 0.0
2019-12-17 1.0 0.0 1.0
2020-03-09 0.0 -1.0 0.0
2020-03-10 0.0 0.0 -1.0
2020-03-26 1.0 1.0 0.0
2020-03-27 1.0 0.0 1.0
2020-05-28 0.0 -1.0 0.0
2020-05-29 0.0 0.0 -1.0
2020-06-09 1.0 1.0 0.0
2020-06-10 1.0 0.0 1.0
2020-06-12 0.0 -1.0 0.0
2020-06-15 0.0 0.0 -1.0
2020-06-16 1.0 1.0 0.0
2020-06-17 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_008_SlowMA_25_FastMA_10
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-07 302.100 315.34 277.423898 273.145330 4.278569
2019-01-08 319.980 320.27 285.214224 276.815255 8.398969
2019-04-15 350.710 348.87 359.842154 360.364242 -0.522089
2019-04-16 355.000 359.46 359.772671 360.294682 -0.522010
2019-04-22 359.700 377.34 362.440073 361.245752 1.194321
2019-04-23 375.450 381.89 365.976423 362.833832 3.142591
2019-05-13 352.290 345.26 364.831825 366.555112 -1.723288
2019-05-14 348.710 345.61 361.336947 364.943931 -3.606984
2019-06-20 365.910 365.21 354.933021 354.552091 0.380930
2019-06-21 365.000 369.21 357.528836 355.679624 1.849212
2019-07-18 323.760 325.21 362.349569 364.708289 -2.358720
2019-07-19 323.400 315.10 353.758739 360.892266 -7.133527
2019-10-17 304.490 293.35 281.832814 280.727246 1.105568
2019-10-18 289.360 275.30 280.645030 280.309765 0.335265
2019-10-22 271.159 266.69 277.721714 279.101634 -1.379920
2019-10-23 268.060 271.27 276.548675 278.499201 -1.950526
2019-10-30 284.340 291.45 280.213551 279.415692 0.797860
2019-10-31 291.000 287.41 281.521997 280.030639 1.491358
2020-03-11 358.920 349.92 364.721530 365.739249 -1.017719
2020-03-12 326.500 315.25 355.726706 361.855461 -6.128754
2020-03-30 363.000 370.96 352.062324 351.640857 0.421467
2020-03-31 367.930 375.50 356.323720 353.476175 2.847544
2020-06-04 422.390 414.33 423.951098 424.561453 -0.610355
2020-06-05 407.290 419.60 423.159989 424.179802 -1.019813
2020-06-10 436.000 434.48 426.391489 425.365580 1.025910
2020-06-11 428.200 425.56 426.240309 425.380535 0.859774
2020-06-12 429.000 418.07 424.754799 424.818186 -0.063388
2020-06-15 421.400 425.50 424.890290 424.870633 0.019656
2020-06-16 425.760 436.13 426.933873 425.736739 1.197135
trade_signal signal_change entry_exit
date
2019-01-07 1.0 1.0 0.0
2019-01-08 1.0 0.0 1.0
2019-04-15 0.0 -1.0 0.0
2019-04-16 0.0 0.0 -1.0
2019-04-22 1.0 1.0 0.0
2019-04-23 1.0 0.0 1.0
2019-05-13 0.0 -1.0 0.0
2019-05-14 0.0 0.0 -1.0
2019-06-20 1.0 1.0 0.0
2019-06-21 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-10-17 1.0 1.0 0.0
2019-10-18 1.0 0.0 1.0
2019-10-22 0.0 -1.0 0.0
2019-10-23 0.0 0.0 -1.0
2019-10-30 1.0 1.0 0.0
2019-10-31 1.0 0.0 1.0
2020-03-11 0.0 -1.0 0.0
2020-03-12 0.0 0.0 -1.0
2020-03-30 1.0 1.0 0.0
2020-03-31 1.0 0.0 1.0
2020-06-04 0.0 -1.0 0.0
2020-06-05 0.0 0.0 -1.0
2020-06-10 1.0 1.0 0.0
2020-06-11 1.0 0.0 1.0
2020-06-12 0.0 -1.0 0.0
2020-06-15 1.0 1.0 -1.0
2020-06-16 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_009_SlowMA_25_FastMA_15
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-07 302.10 315.340 273.784597 273.145330 0.639267
2019-01-08 319.98 320.270 279.599030 276.815255 2.783774
2019-04-17 365.05 354.740 359.865024 359.867378 -0.002354
2019-04-18 355.00 360.350 359.925646 359.904504 0.021142
2019-04-22 359.70 377.340 362.102440 361.245752 0.856688
2019-05-13 352.29 345.260 366.452781 366.555112 -0.102331
2019-05-14 348.71 345.610 363.847434 364.943931 -1.096498
2019-06-21 365.00 369.210 355.980198 355.679624 0.300574
2019-06-24 370.27 371.040 357.862673 356.861193 1.001480
2019-07-18 323.76 325.210 364.588903 364.708289 -0.119387
2019-07-19 323.40 315.100 358.402790 360.892266 -2.489476
2019-10-31 291.00 287.410 280.275545 280.030639 0.244906
2019-11-01 288.70 286.810 281.092352 280.552128 0.540224
2020-03-12 326.50 315.250 360.250567 361.855461 -1.604893
2020-03-13 330.51 336.295 357.256121 359.889271 -2.633150
2020-03-31 367.93 375.500 353.819351 353.476175 0.343176
2020-04-01 376.05 364.080 355.101932 354.291854 0.810078
trade_signal signal_change entry_exit
date
2019-01-07 1.0 1.0 0.0
2019-01-08 1.0 0.0 1.0
2019-04-17 0.0 -1.0 0.0
2019-04-18 1.0 1.0 -1.0
2019-04-22 1.0 0.0 1.0
2019-05-13 0.0 -1.0 0.0
2019-05-14 0.0 0.0 -1.0
2019-06-21 1.0 1.0 0.0
2019-06-24 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-10-31 1.0 1.0 0.0
2019-11-01 1.0 0.0 1.0
2020-03-12 0.0 -1.0 0.0
2020-03-13 0.0 0.0 -1.0
2020-03-31 1.0 1.0 0.0
2020-04-01 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_010_SlowMA_25_FastMA_20
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-08 319.98 320.270 277.448029 276.815255 0.632774
2019-01-09 317.71 319.960 281.511745 280.172035 1.339710
2019-05-14 348.71 345.610 364.763642 364.943931 -0.180289
2019-05-15 343.34 354.990 363.832819 364.178236 -0.345417
2019-06-24 370.27 371.040 357.059886 356.861193 0.198693
2019-06-25 370.75 360.300 357.368469 357.125717 0.242752
2019-07-19 323.40 315.100 360.188502 360.892266 -0.703764
2019-07-22 312.00 310.620 355.467692 357.025168 -1.557476
2019-11-04 288.00 292.860 281.673806 281.498887 0.174918
2019-11-05 289.99 288.030 282.279158 282.001281 0.277877
2020-03-12 326.50 315.250 361.845347 361.855461 -0.010113
2020-03-13 330.51 336.295 359.411981 359.889271 -0.477290
2020-04-01 376.05 364.080 354.431714 354.291854 0.139859
2020-04-02 364.08 370.080 355.922027 355.506327 0.415700
trade_signal signal_change entry_exit
date
2019-01-08 1.0 1.0 0.0
2019-01-09 1.0 0.0 1.0
2019-05-14 0.0 -1.0 0.0
2019-05-15 0.0 0.0 -1.0
2019-06-24 1.0 1.0 0.0
2019-06-25 1.0 0.0 1.0
2019-07-19 0.0 -1.0 0.0
2019-07-22 0.0 0.0 -1.0
2019-11-04 1.0 1.0 0.0
2019-11-05 1.0 0.0 1.0
2020-03-12 0.0 -1.0 0.0
2020-03-13 0.0 0.0 -1.0
2020-04-01 1.0 1.0 0.0
2020-04-02 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_011_SlowMA_30_FastMA_05
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-04 281.880 297.57 275.730669 270.828146 4.902523
2019-01-07 302.100 315.34 288.933780 273.780439 15.153341
2019-04-15 350.710 348.87 356.738219 359.476217 -2.737999
2019-04-16 355.000 359.46 357.645479 359.475171 -1.829692
2019-04-22 359.700 377.34 364.380883 360.413402 3.967480
2019-04-23 375.450 381.89 370.217255 361.799280 8.417975
2019-05-10 361.620 361.04 366.337678 367.433126 -1.095447
2019-05-13 352.290 345.26 359.311786 366.002483 -6.690698
2019-06-19 361.720 363.52 354.827306 354.310073 0.517232
2019-06-20 365.910 365.21 358.288204 355.013304 3.274900
2019-07-18 323.760 325.21 353.858302 364.334250 -10.475948
2019-07-19 323.400 315.10 340.938868 361.157835 -20.218967
2019-10-15 283.820 284.25 281.118436 281.062833 0.055603
2019-10-16 283.120 286.28 282.838957 281.399425 1.439533
2019-10-21 272.890 278.05 281.124506 281.489939 -0.365433
2019-10-22 271.159 266.69 276.313004 280.535104 -4.222100
2019-10-30 284.340 291.45 282.780469 280.283929 2.496541
2019-10-31 291.000 287.41 284.323646 280.743675 3.579971
2020-03-09 343.860 346.49 364.288284 365.160028 -0.871743
2020-03-10 356.425 364.13 364.235523 365.093574 -0.858051
2020-03-26 344.000 362.99 350.341988 350.144465 0.197524
2020-03-27 359.090 357.12 352.601326 350.594499 2.006826
2020-05-28 417.240 413.44 422.661033 423.009849 -0.348816
2020-05-29 417.460 419.73 421.684022 422.798246 -1.114224
2020-06-01 418.830 425.92 423.096015 422.999649 0.096365
2020-06-02 425.870 427.31 424.500676 423.277736 1.222940
2020-06-04 422.390 414.33 420.548078 422.621536 -2.073458
2020-06-05 407.290 419.60 420.232052 422.426598 -2.194546
2020-06-09 421.650 434.05 424.673134 422.999260 1.673874
2020-06-10 436.000 434.48 427.942090 423.739953 4.202136
trade_signal signal_change entry_exit
date
2019-01-04 1.0 1.0 0.0
2019-01-07 1.0 0.0 1.0
2019-04-15 0.0 -1.0 0.0
2019-04-16 0.0 0.0 -1.0
2019-04-22 1.0 1.0 0.0
2019-04-23 1.0 0.0 1.0
2019-05-10 0.0 -1.0 0.0
2019-05-13 0.0 0.0 -1.0
2019-06-19 1.0 1.0 0.0
2019-06-20 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-10-15 1.0 1.0 0.0
2019-10-16 1.0 0.0 1.0
2019-10-21 0.0 -1.0 0.0
2019-10-22 0.0 0.0 -1.0
2019-10-30 1.0 1.0 0.0
2019-10-31 1.0 0.0 1.0
2020-03-09 0.0 -1.0 0.0
2020-03-10 0.0 0.0 -1.0
2020-03-26 1.0 1.0 0.0
2020-03-27 1.0 0.0 1.0
2020-05-28 0.0 -1.0 0.0
2020-05-29 0.0 0.0 -1.0
2020-06-01 1.0 1.0 0.0
2020-06-02 1.0 0.0 1.0
2020-06-04 0.0 -1.0 0.0
2020-06-05 0.0 0.0 -1.0
2020-06-09 1.0 1.0 0.0
2020-06-10 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_012_SlowMA_30_FastMA_10
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-07 302.10 315.340 277.423898 273.780439 3.643460
2019-01-08 319.98 320.270 285.214224 276.858334 8.355890
2019-04-17 365.05 354.740 358.857640 359.169598 -0.311958
2019-04-18 355.00 360.350 359.128978 359.245771 -0.116793
2019-04-22 359.70 377.340 362.440073 360.413402 2.026671
2019-04-23 375.45 381.890 365.976423 361.799280 4.177144
2019-05-13 352.29 345.260 364.831825 366.002483 -1.170659
2019-05-14 348.71 345.610 361.336947 364.686738 -3.349790
2019-06-21 365.00 369.210 357.528836 355.929232 1.599604
2019-06-24 370.27 371.040 359.985411 356.904132 3.081279
2019-07-18 323.76 325.210 362.349569 364.334250 -1.984680
2019-07-19 323.40 315.100 353.758739 361.157835 -7.399097
2019-10-31 291.00 287.410 281.521997 280.743675 0.778321
2019-11-01 288.70 286.810 282.483452 281.135051 1.348401
2020-03-12 326.50 315.250 355.726706 360.962077 -5.235370
2020-03-13 330.51 336.295 352.193669 359.370653 -7.176984
2020-03-30 363.00 370.960 352.062324 351.908403 0.153921
2020-03-31 367.93 375.500 356.323720 353.430441 2.893278
trade_signal signal_change entry_exit
date
2019-01-07 1.0 1.0 0.0
2019-01-08 1.0 0.0 1.0
2019-04-17 0.0 -1.0 0.0
2019-04-18 0.0 0.0 -1.0
2019-04-22 1.0 1.0 0.0
2019-04-23 1.0 0.0 1.0
2019-05-13 0.0 -1.0 0.0
2019-05-14 0.0 0.0 -1.0
2019-06-21 1.0 1.0 0.0
2019-06-24 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-10-31 1.0 1.0 0.0
2019-11-01 1.0 0.0 1.0
2020-03-12 0.0 -1.0 0.0
2020-03-13 0.0 0.0 -1.0
2020-03-30 1.0 1.0 0.0
2020-03-31 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_013_SlowMA_30_FastMA_15
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-07 302.10 315.340 273.784597 273.780439 0.004158
2019-01-08 319.98 320.270 279.599030 276.858334 2.740696
2019-05-14 348.71 345.610 363.847434 364.686738 -0.839304
2019-05-15 343.34 354.990 362.740254 364.061097 -1.320842
2019-06-21 365.00 369.210 355.980198 355.929232 0.050966
2019-06-24 370.27 371.040 357.862673 356.904132 0.958541
2019-07-19 323.40 315.100 358.402790 361.157835 -2.755045
2019-07-22 312.00 310.620 352.429941 357.897319 -5.467378
2019-11-04 288.00 292.860 282.563308 281.891500 0.671808
2019-11-05 289.99 288.030 283.246644 282.287532 0.959113
2020-03-12 326.50 315.250 360.250567 360.962077 -0.711509
2020-03-13 330.51 336.295 357.256121 359.370653 -2.114531
2020-03-31 367.93 375.500 353.819351 353.430441 0.388910
2020-04-01 376.05 364.080 355.101932 354.117510 0.984423
trade_signal signal_change entry_exit
date
2019-01-07 1.0 1.0 0.0
2019-01-08 1.0 0.0 1.0
2019-05-14 0.0 -1.0 0.0
2019-05-15 0.0 0.0 -1.0
2019-06-21 1.0 1.0 0.0
2019-06-24 1.0 0.0 1.0
2019-07-19 0.0 -1.0 0.0
2019-07-22 0.0 0.0 -1.0
2019-11-04 1.0 1.0 0.0
2019-11-05 1.0 0.0 1.0
2020-03-12 0.0 -1.0 0.0
2020-03-13 0.0 0.0 -1.0
2020-03-31 1.0 1.0 0.0
2020-04-01 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_014_SlowMA_30_FastMA_20
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-08 319.98 320.27 277.448029 276.858334 0.589695
2019-01-09 317.71 319.96 281.511745 279.707116 1.804630
2019-05-15 343.34 354.99 363.832819 364.061097 -0.228278
2019-05-16 356.37 359.31 363.402074 363.754554 -0.352480
2019-06-24 370.27 371.04 357.059886 356.904132 0.155755
2019-06-25 370.75 360.30 357.368469 357.123222 0.245246
2019-07-19 323.40 315.10 360.188502 361.157835 -0.969334
2019-07-22 312.00 310.62 355.467692 357.897319 -2.429627
2019-11-06 288.19 288.59 282.880190 282.694143 0.186047
2019-11-07 290.70 289.57 283.517315 283.137746 0.379569
2020-03-16 306.63 298.84 353.643221 355.465449 -1.822228
2020-03-17 306.18 319.75 350.415295 353.161227 -2.745932
2020-04-01 376.05 364.08 354.431714 354.117510 0.314204
2020-04-02 364.08 370.08 355.922027 355.147348 0.774679
trade_signal signal_change entry_exit
date
2019-01-08 1.0 1.0 0.0
2019-01-09 1.0 0.0 1.0
2019-05-15 0.0 -1.0 0.0
2019-05-16 0.0 0.0 -1.0
2019-06-24 1.0 1.0 0.0
2019-06-25 1.0 0.0 1.0
2019-07-19 0.0 -1.0 0.0
2019-07-22 0.0 0.0 -1.0
2019-11-06 1.0 1.0 0.0
2019-11-07 1.0 0.0 1.0
2020-03-16 0.0 -1.0 0.0
2020-03-17 0.0 0.0 -1.0
2020-04-01 1.0 1.0 0.0
2020-04-02 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_015_SlowMA_35_FastMA_05
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-04 281.88 297.57 275.730669 272.014659 3.716010
2019-01-07 302.10 315.34 288.933780 274.536780 14.396999
2019-04-15 350.71 348.87 356.738219 358.284784 -1.546566
2019-04-16 355.00 359.46 357.645479 358.350132 -0.704653
2019-04-22 359.70 377.34 364.380883 359.331890 5.048993
2019-04-23 375.45 381.89 370.217255 360.586001 9.631254
2019-05-10 361.62 361.04 366.337678 366.385168 -0.047489
2019-05-13 352.29 345.26 359.311786 365.211176 -5.899390
2019-06-20 365.91 365.21 358.288204 355.406554 2.881649
2019-06-21 365.00 369.21 361.928802 356.173461 5.755341
2019-07-18 323.76 325.21 353.858302 363.935179 -10.076877
2019-07-19 323.40 315.10 340.938868 361.222055 -20.283187
2019-10-17 304.49 293.35 286.342638 283.980897 2.361741
2019-10-18 289.36 275.30 282.661759 283.498625 -0.836866
2019-10-21 272.89 278.05 281.124506 283.195924 -2.071418
2019-10-30 284.34 291.45 282.780469 281.520088 1.260382
2019-10-31 291.00 287.41 284.323646 281.847305 2.476341
2020-03-11 358.92 349.92 359.463682 362.153190 -2.689508
2020-03-12 326.50 315.25 344.725788 359.547458 -14.821670
2020-03-26 344.00 362.99 350.341988 350.305318 0.036670
2020-03-27 359.09 357.12 352.601326 350.683911 1.917414
2020-06-05 407.29 419.60 420.232052 420.236892 -0.004839
2020-06-08 416.00 419.49 419.984702 420.195398 -0.210696
2020-06-09 421.65 434.05 424.673134 420.965098 3.708037
2020-06-10 436.00 434.48 427.942090 421.715926 6.226164
trade_signal signal_change entry_exit
date
2019-01-04 1.0 1.0 0.0
2019-01-07 1.0 0.0 1.0
2019-04-15 0.0 -1.0 0.0
2019-04-16 0.0 0.0 -1.0
2019-04-22 1.0 1.0 0.0
2019-04-23 1.0 0.0 1.0
2019-05-10 0.0 -1.0 0.0
2019-05-13 0.0 0.0 -1.0
2019-06-20 1.0 1.0 0.0
2019-06-21 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-10-17 1.0 1.0 0.0
2019-10-18 0.0 -1.0 1.0
2019-10-21 0.0 0.0 -1.0
2019-10-30 1.0 1.0 0.0
2019-10-31 1.0 0.0 1.0
2020-03-11 0.0 -1.0 0.0
2020-03-12 0.0 0.0 -1.0
2020-03-26 1.0 1.0 0.0
2020-03-27 1.0 0.0 1.0
2020-06-05 0.0 -1.0 0.0
2020-06-08 0.0 0.0 -1.0
2020-06-09 1.0 1.0 0.0
2020-06-10 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_016_SlowMA_35_FastMA_10
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-07 302.10 315.340 277.423898 274.536780 2.887118
2019-01-08 319.98 320.270 285.214224 277.192015 8.022209
2019-05-13 352.29 345.260 364.831825 365.211176 -0.379351
2019-05-14 348.71 345.610 361.336947 364.121897 -2.784949
2019-06-21 365.00 369.210 357.528836 356.173461 1.355374
2019-06-24 370.27 371.040 359.985411 356.999430 2.985981
2019-07-18 323.76 325.210 362.349569 363.935179 -1.585609
2019-07-19 323.40 315.100 353.758739 361.222055 -7.463316
2019-11-01 288.70 286.810 282.483452 282.123011 0.360441
2019-11-04 288.00 292.860 284.370097 282.719510 1.650587
2020-03-12 326.50 315.250 355.726706 359.547458 -3.820751
2020-03-13 330.51 336.295 352.193669 358.255654 -6.061985
2020-03-30 363.00 370.960 352.062324 351.810361 0.251963
2020-03-31 367.93 375.500 356.323720 353.126452 3.197268
trade_signal signal_change entry_exit
date
2019-01-07 1.0 1.0 0.0
2019-01-08 1.0 0.0 1.0
2019-05-13 0.0 -1.0 0.0
2019-05-14 0.0 0.0 -1.0
2019-06-21 1.0 1.0 0.0
2019-06-24 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-11-01 1.0 1.0 0.0
2019-11-04 1.0 0.0 1.0
2020-03-12 0.0 -1.0 0.0
2020-03-13 0.0 0.0 -1.0
2020-03-30 1.0 1.0 0.0
2020-03-31 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_017_SlowMA_35_FastMA_15
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-08 319.98 320.270 279.599030 277.192015 2.407015
2019-01-09 317.71 319.960 284.647006 279.668889 4.978117
2019-05-14 348.71 345.610 363.847434 364.121897 -0.274463
2019-05-15 343.34 354.990 362.740254 363.614426 -0.874172
2019-06-24 370.27 371.040 357.862673 356.999430 0.863243
2019-06-25 370.75 360.300 358.167339 357.182805 0.984533
2019-07-19 323.40 315.100 358.402790 361.222055 -2.819265
2019-07-22 312.00 310.620 352.429941 358.410772 -5.980831
2019-11-05 289.99 288.030 283.246644 283.014538 0.232107
2019-11-06 288.19 288.590 283.914564 283.324286 0.590278
2020-03-13 330.51 336.295 357.256121 358.255654 -0.999533
2020-03-16 306.63 298.840 349.954106 354.954785 -5.000678
2020-03-31 367.93 375.500 353.819351 353.126452 0.692899
2020-04-01 376.05 364.080 355.101932 353.734982 1.366950
trade_signal signal_change entry_exit
date
2019-01-08 1.0 1.0 0.0
2019-01-09 1.0 0.0 1.0
2019-05-14 0.0 -1.0 0.0
2019-05-15 0.0 0.0 -1.0
2019-06-24 1.0 1.0 0.0
2019-06-25 1.0 0.0 1.0
2019-07-19 0.0 -1.0 0.0
2019-07-22 0.0 0.0 -1.0
2019-11-05 1.0 1.0 0.0
2019-11-06 1.0 0.0 1.0
2020-03-13 0.0 -1.0 0.0
2020-03-16 0.0 0.0 -1.0
2020-03-31 1.0 1.0 0.0
2020-04-01 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_018_SlowMA_35_FastMA_20
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-08 319.98 320.27 277.448029 277.192015 0.256014
2019-01-09 317.71 319.96 281.511745 279.668889 1.842856
2019-05-17 356.39 354.45 362.549495 362.879257 -0.329762
2019-05-20 351.23 348.11 361.174304 362.058548 -0.884243
2019-06-24 370.27 371.04 357.059886 356.999430 0.060456
2019-06-25 370.75 360.30 357.368469 357.182805 0.185663
2019-07-19 323.40 315.10 360.188502 361.222055 -1.033553
2019-07-22 312.00 310.62 355.467692 358.410772 -2.943080
2019-11-08 288.73 291.57 284.284237 284.110088 0.174149
2019-11-11 289.16 294.18 285.226691 284.669528 0.557163
2020-03-16 306.63 298.84 353.643221 354.954785 -1.311564
2020-03-17 306.18 319.75 350.415295 352.998963 -2.583668
2020-03-31 367.93 375.50 353.416104 353.126452 0.289653
2020-04-01 376.05 364.08 354.431714 353.734982 0.696731
trade_signal signal_change entry_exit
date
2019-01-08 1.0 1.0 0.0
2019-01-09 1.0 0.0 1.0
2019-05-17 0.0 -1.0 0.0
2019-05-20 0.0 0.0 -1.0
2019-06-24 1.0 1.0 0.0
2019-06-25 1.0 0.0 1.0
2019-07-19 0.0 -1.0 0.0
2019-07-22 0.0 0.0 -1.0
2019-11-08 1.0 1.0 0.0
2019-11-11 1.0 0.0 1.0
2020-03-16 0.0 -1.0 0.0
2020-03-17 0.0 0.0 -1.0
2020-03-31 1.0 1.0 0.0
2020-04-01 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_019_SlowMA_40_FastMA_05
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-04 281.88 297.57 275.730669 273.083775 2.646894
2019-01-07 302.10 315.34 288.933780 275.293475 13.640304
2019-04-15 350.71 348.87 356.738219 356.900436 -0.162217
2019-04-16 355.00 359.46 357.645479 357.025559 0.619920
2019-04-17 365.05 354.74 356.676986 356.913842 -0.236856
2019-04-18 355.00 360.35 357.901324 357.081783 0.819541
2019-04-22 359.70 377.34 364.380883 358.071805 6.309078
2019-05-13 352.29 345.26 359.311786 364.241495 -4.929709
2019-05-14 348.71 345.61 354.744524 363.331892 -8.587368
2019-06-20 365.91 365.21 358.288204 355.672711 2.615493
2019-06-21 365.00 369.21 361.928802 356.333208 5.595595
2019-07-18 323.76 325.21 353.858302 363.533074 -9.674772
2019-07-19 323.40 315.10 340.938868 361.170290 -20.231422
2019-10-17 304.49 293.35 286.342638 286.001636 0.341002
2019-10-18 289.36 275.30 282.661759 285.479603 -2.817844
2019-10-21 272.89 278.05 281.124506 285.117182 -3.992676
2019-10-31 291.00 287.41 284.323646 283.231255 1.092392
2019-11-01 288.70 286.81 285.152431 283.405828 1.746603
2020-03-11 358.92 349.92 359.463682 360.027331 -0.563649
2020-03-12 326.50 315.25 344.725788 357.843071 -13.117283
2020-03-26 344.00 362.99 350.341988 350.036550 0.305439
2020-03-27 359.09 357.12 352.601326 350.382084 2.219242
trade_signal signal_change entry_exit
date
2019-01-04 1.0 1.0 0.0
2019-01-07 1.0 0.0 1.0
2019-04-15 0.0 -1.0 0.0
2019-04-16 1.0 1.0 -1.0
2019-04-17 0.0 -1.0 1.0
2019-04-18 1.0 1.0 -1.0
2019-04-22 1.0 0.0 1.0
2019-05-13 0.0 -1.0 0.0
2019-05-14 0.0 0.0 -1.0
2019-06-20 1.0 1.0 0.0
2019-06-21 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-10-17 1.0 1.0 0.0
2019-10-18 0.0 -1.0 1.0
2019-10-21 0.0 0.0 -1.0
2019-10-31 1.0 1.0 0.0
2019-11-01 1.0 0.0 1.0
2020-03-11 0.0 -1.0 0.0
2020-03-12 0.0 0.0 -1.0
2020-03-26 1.0 1.0 0.0
2020-03-27 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_020_SlowMA_40_FastMA_10
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-07 302.10 315.340 277.423898 275.293475 2.130423
2019-01-08 319.98 320.270 285.214224 277.637195 7.577029
2019-05-14 348.71 345.610 361.336947 363.331892 -1.994945
2019-05-15 343.34 354.990 360.182957 362.924651 -2.741694
2019-06-21 365.00 369.210 357.528836 356.333208 1.195628
2019-06-24 370.27 371.040 359.985411 357.050758 2.934653
2019-07-18 323.76 325.210 362.349569 363.533074 -1.183504
2019-07-19 323.40 315.100 353.758739 361.170290 -7.411551
2019-11-04 288.00 292.860 284.370097 283.867008 0.503089
2019-11-05 289.99 288.030 285.035534 284.070081 0.965453
2020-03-12 326.50 315.250 355.726706 357.843071 -2.116365
2020-03-13 330.51 336.295 352.193669 356.791946 -4.598277
2020-03-30 363.00 370.960 352.062324 351.385885 0.676439
2020-03-31 367.93 375.500 356.323720 352.562183 3.761537
trade_signal signal_change entry_exit
date
2019-01-07 1.0 1.0 0.0
2019-01-08 1.0 0.0 1.0
2019-05-14 0.0 -1.0 0.0
2019-05-15 0.0 0.0 -1.0
2019-06-21 1.0 1.0 0.0
2019-06-24 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-11-04 1.0 1.0 0.0
2019-11-05 1.0 0.0 1.0
2020-03-12 0.0 -1.0 0.0
2020-03-13 0.0 0.0 -1.0
2020-03-30 1.0 1.0 0.0
2020-03-31 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_021_SlowMA_40_FastMA_15
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-08 319.98 320.27 279.599030 277.637195 1.961835
2019-01-09 317.71 319.96 284.647006 279.835312 4.811694
2019-05-15 343.34 354.99 362.740254 362.924651 -0.184397
2019-05-16 356.37 359.31 362.311473 362.748195 -0.436723
2019-06-24 370.27 371.04 357.862673 357.050758 0.811915
2019-06-25 370.75 360.30 358.167339 357.209288 0.958051
2019-07-19 323.40 315.10 358.402790 361.170290 -2.767500
2019-07-22 312.00 310.62 352.429941 358.704228 -6.274287
2019-11-07 290.70 289.57 284.621493 284.548099 0.073394
2019-11-08 288.73 291.57 285.490057 284.890631 0.599425
2020-03-16 306.63 298.84 349.954106 353.965021 -4.010915
2020-03-17 306.18 319.75 346.178593 352.295996 -6.117403
2020-03-31 367.93 375.50 353.819351 352.562183 1.257168
2020-04-01 376.05 364.08 355.101932 353.124028 1.977904
trade_signal signal_change entry_exit
date
2019-01-08 1.0 1.0 0.0
2019-01-09 1.0 0.0 1.0
2019-05-15 0.0 -1.0 0.0
2019-05-16 0.0 0.0 -1.0
2019-06-24 1.0 1.0 0.0
2019-06-25 1.0 0.0 1.0
2019-07-19 0.0 -1.0 0.0
2019-07-22 0.0 0.0 -1.0
2019-11-07 1.0 1.0 0.0
2019-11-08 1.0 0.0 1.0
2020-03-16 0.0 -1.0 0.0
2020-03-17 0.0 0.0 -1.0
2020-03-31 1.0 1.0 0.0
2020-04-01 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_022_SlowMA_40_FastMA_20
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-09 317.71 319.96 281.511745 279.835312 1.676433
2019-01-10 314.57 324.66 285.634833 282.156043 3.478790
2019-05-20 351.23 348.11 361.174304 361.648351 -0.474047
2019-05-21 350.95 354.27 360.516751 361.288200 -0.771449
2019-06-24 370.27 371.04 357.059886 357.050758 0.009129
2019-06-25 370.75 360.30 357.368469 357.209288 0.159181
2019-07-19 323.40 315.10 360.188502 361.170290 -0.981788
2019-07-22 312.00 310.62 355.467692 358.704228 -3.236536
2019-11-12 295.32 292.01 285.872720 285.668954 0.203766
2019-11-13 291.03 283.11 285.609604 285.544127 0.065477
2020-03-16 306.63 298.84 353.643221 353.965021 -0.321801
2020-03-17 306.18 319.75 350.415295 352.295996 -1.880701
2020-03-31 367.93 375.50 353.416104 352.562183 0.853921
2020-04-01 376.05 364.08 354.431714 353.124028 1.307686
trade_signal signal_change entry_exit
date
2019-01-09 1.0 1.0 0.0
2019-01-10 1.0 0.0 1.0
2019-05-20 0.0 -1.0 0.0
2019-05-21 0.0 0.0 -1.0
2019-06-24 1.0 1.0 0.0
2019-06-25 1.0 0.0 1.0
2019-07-19 0.0 -1.0 0.0
2019-07-22 0.0 0.0 -1.0
2019-11-12 1.0 1.0 0.0
2019-11-13 1.0 0.0 1.0
2020-03-16 0.0 -1.0 0.0
2020-03-17 0.0 0.0 -1.0
2020-03-31 1.0 1.0 0.0
2020-04-01 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_023_SlowMA_45_FastMA_05
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-04 281.88 297.570 275.730669 274.027704 1.702965
2019-01-07 302.10 315.340 288.933780 276.003016 12.930763
2019-05-13 352.29 345.260 359.311786 363.147351 -3.835566
2019-05-14 348.71 345.610 354.744524 362.383472 -7.638948
2019-06-20 365.91 365.210 358.288204 355.793544 2.494660
2019-06-21 365.00 369.210 361.928802 356.377187 5.551616
2019-07-18 323.76 325.210 353.858302 363.121323 -9.263021
2019-07-19 323.40 315.100 340.938868 361.032950 -20.094081
2019-11-01 288.70 286.810 285.152431 284.890309 0.262122
2019-11-04 288.00 292.860 287.721621 285.236820 2.484800
2020-03-12 326.50 315.250 344.725788 355.997124 -11.271336
2020-03-13 330.51 336.295 341.915525 355.140510 -13.224984
2020-03-26 344.00 362.990 350.341988 349.453249 0.888740
2020-03-27 359.09 357.120 352.601326 349.786586 2.814740
trade_signal signal_change entry_exit
date
2019-01-04 1.0 1.0 0.0
2019-01-07 1.0 0.0 1.0
2019-05-13 0.0 -1.0 0.0
2019-05-14 0.0 0.0 -1.0
2019-06-20 1.0 1.0 0.0
2019-06-21 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-11-01 1.0 1.0 0.0
2019-11-04 1.0 0.0 1.0
2020-03-12 0.0 -1.0 0.0
2020-03-13 0.0 0.0 -1.0
2020-03-26 1.0 1.0 0.0
2020-03-27 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_024_SlowMA_45_FastMA_10
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-07 302.10 315.340 277.423898 276.003016 1.420882
2019-01-08 319.98 320.270 285.214224 278.110467 7.103757
2019-05-14 348.71 345.610 361.336947 362.383472 -1.046525
2019-05-15 343.34 354.990 360.182957 362.061458 -1.878501
2019-06-21 365.00 369.210 357.528836 356.377187 1.151649
2019-06-24 370.27 371.040 359.985411 357.015034 2.970377
2019-07-18 323.76 325.210 362.349569 363.121323 -0.771754
2019-07-19 323.40 315.100 353.758739 361.032950 -7.274211
2019-11-06 288.19 288.590 285.681800 285.498775 0.183025
2019-11-07 290.70 289.570 286.388746 285.675786 0.712959
2020-03-12 326.50 315.250 355.726706 355.997124 -0.270417
2020-03-13 330.51 336.295 352.193669 355.140510 -2.946841
2020-03-30 363.00 370.960 352.062324 350.707169 1.355155
2020-03-31 367.93 375.500 356.323720 351.785119 4.538601
trade_signal signal_change entry_exit
date
2019-01-07 1.0 1.0 0.0
2019-01-08 1.0 0.0 1.0
2019-05-14 0.0 -1.0 0.0
2019-05-15 0.0 0.0 -1.0
2019-06-21 1.0 1.0 0.0
2019-06-24 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-11-06 1.0 1.0 0.0
2019-11-07 1.0 0.0 1.0
2020-03-12 0.0 -1.0 0.0
2020-03-13 0.0 0.0 -1.0
2020-03-30 1.0 1.0 0.0
2020-03-31 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_025_SlowMA_45_FastMA_15
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-08 319.98 320.27 279.599030 278.110467 1.488563
2019-01-09 317.71 319.96 284.647006 280.094634 4.552372
2019-05-17 356.39 354.45 361.328788 361.615389 -0.286601
2019-05-20 351.23 348.11 359.676440 361.027306 -1.350866
2019-06-24 370.27 371.04 357.862673 357.015034 0.847640
2019-06-25 370.75 360.30 358.167339 357.157930 1.009409
2019-07-19 323.40 315.10 358.402790 361.032950 -2.630160
2019-07-22 312.00 310.62 352.429941 358.840590 -6.410649
2019-11-11 289.16 294.18 286.576300 286.290667 0.285633
2019-11-12 295.32 292.01 287.255512 286.539335 0.716177
2020-03-16 306.63 298.84 349.954106 352.692661 -2.738555
2020-03-17 306.18 319.75 346.178593 351.260371 -5.081778
2020-03-30 363.00 370.96 350.722116 350.707169 0.014946
2020-03-31 367.93 375.50 353.819351 351.785119 2.034233
trade_signal signal_change entry_exit
date
2019-01-08 1.0 1.0 0.0
2019-01-09 1.0 0.0 1.0
2019-05-17 0.0 -1.0 0.0
2019-05-20 0.0 0.0 -1.0
2019-06-24 1.0 1.0 0.0
2019-06-25 1.0 0.0 1.0
2019-07-19 0.0 -1.0 0.0
2019-07-22 0.0 0.0 -1.0
2019-11-11 1.0 1.0 0.0
2019-11-12 1.0 0.0 1.0
2020-03-16 0.0 -1.0 0.0
2020-03-17 0.0 0.0 -1.0
2020-03-30 1.0 1.0 0.0
2020-03-31 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_026_SlowMA_45_FastMA_20
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-09 317.710 319.96 281.511745 280.094634 1.417111
2019-01-10 314.570 324.66 285.634833 282.199286 3.435547
2019-05-21 350.950 354.27 360.516751 360.733082 -0.216331
2019-05-22 358.010 359.73 360.441823 360.689409 -0.247587
2019-06-24 370.270 371.04 357.059886 357.015034 0.044853
2019-06-25 370.750 360.30 357.368469 357.157930 0.210539
2019-07-19 323.400 315.10 360.188502 361.032950 -0.844448
2019-07-22 312.000 310.62 355.467692 358.840590 -3.372898
2019-11-18 296.000 302.57 288.349271 287.581496 0.767774
2019-11-19 304.010 302.60 289.706483 288.234478 1.472005
2020-03-17 306.180 319.75 350.415295 351.260371 -0.845076
2020-03-18 302.395 315.47 347.087172 349.704268 -2.617096
2020-03-30 363.000 370.96 351.091484 350.707169 0.384315
2020-03-31 367.930 375.50 353.416104 351.785119 1.630986
trade_signal signal_change entry_exit
date
2019-01-09 1.0 1.0 0.0
2019-01-10 1.0 0.0 1.0
2019-05-21 0.0 -1.0 0.0
2019-05-22 0.0 0.0 -1.0
2019-06-24 1.0 1.0 0.0
2019-06-25 1.0 0.0 1.0
2019-07-19 0.0 -1.0 0.0
2019-07-22 0.0 0.0 -1.0
2019-11-18 1.0 1.0 0.0
2019-11-19 1.0 0.0 1.0
2020-03-17 0.0 -1.0 0.0
2020-03-18 0.0 0.0 -1.0
2020-03-30 1.0 1.0 0.0
2020-03-31 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_027_SlowMA_50_FastMA_05
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-04 281.88 297.570 275.730669 274.855477 0.875192
2019-01-07 302.10 315.340 288.933780 276.650000 12.283780
2019-05-13 352.29 345.260 359.311786 361.976994 -2.665208
2019-05-14 348.71 345.610 354.744524 361.332954 -6.588431
2019-06-20 365.91 365.210 358.288204 355.773805 2.514398
2019-06-21 365.00 369.210 361.928802 356.301326 5.627477
2019-07-18 323.76 325.210 353.858302 362.689950 -8.831648
2019-07-19 323.40 315.100 340.938868 360.822666 -19.883798
2019-11-04 288.00 292.860 287.721621 286.750361 0.971260
2019-11-05 289.99 288.030 287.824414 286.800544 1.023870
2020-03-12 326.50 315.250 344.725788 354.107398 -9.381610
2020-03-13 330.51 336.295 341.915525 353.408872 -11.493346
2020-03-26 344.00 362.990 350.341988 348.653847 1.688141
2020-03-27 359.09 357.120 352.601326 348.985853 3.615472
trade_signal signal_change entry_exit
date
2019-01-04 1.0 1.0 0.0
2019-01-07 1.0 0.0 1.0
2019-05-13 0.0 -1.0 0.0
2019-05-14 0.0 0.0 -1.0
2019-06-20 1.0 1.0 0.0
2019-06-21 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-11-04 1.0 1.0 0.0
2019-11-05 1.0 0.0 1.0
2020-03-12 0.0 -1.0 0.0
2020-03-13 0.0 0.0 -1.0
2020-03-26 1.0 1.0 0.0
2020-03-27 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_028_SlowMA_50_FastMA_10
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-07 302.10 315.340 277.423898 276.650000 0.773899
2019-01-08 319.98 320.270 285.214224 278.573675 6.640550
2019-05-15 343.34 354.990 360.182957 361.083393 -0.900436
2019-05-16 356.37 359.310 360.024238 361.013629 -0.989391
2019-06-21 365.00 369.210 357.528836 356.301326 1.227510
2019-06-24 370.27 371.040 359.985411 356.879957 3.105454
2019-07-18 323.76 325.210 362.349569 362.689950 -0.340380
2019-07-19 323.40 315.100 353.758739 360.822666 -7.063927
2019-11-08 288.73 291.570 287.330792 287.156715 0.174077
2019-11-11 289.16 294.180 288.576103 287.432144 1.143958
2020-03-13 330.51 336.295 352.193669 353.408872 -1.215203
2020-03-16 306.63 298.840 342.493002 351.268914 -8.775912
2020-03-30 363.00 370.960 352.062324 349.847585 2.214739
2020-03-31 367.93 375.500 356.323720 350.853562 5.470157
trade_signal signal_change entry_exit
date
2019-01-07 1.0 1.0 0.0
2019-01-08 1.0 0.0 1.0
2019-05-15 0.0 -1.0 0.0
2019-05-16 0.0 0.0 -1.0
2019-06-21 1.0 1.0 0.0
2019-06-24 1.0 0.0 1.0
2019-07-18 0.0 -1.0 0.0
2019-07-19 0.0 0.0 -1.0
2019-11-08 1.0 1.0 0.0
2019-11-11 1.0 0.0 1.0
2020-03-13 0.0 -1.0 0.0
2020-03-16 0.0 0.0 -1.0
2020-03-30 1.0 1.0 0.0
2020-03-31 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_029_SlowMA_50_FastMA_15
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-08 319.98 320.27 279.599030 278.573675 1.025355
2019-01-09 317.71 319.96 284.647006 280.389970 4.257036
2019-05-20 351.23 348.11 359.676440 360.258105 -0.581665
2019-05-21 350.95 354.27 359.000635 360.022620 -1.021985
2019-06-24 370.27 371.04 357.862673 356.879957 0.982716
2019-06-25 370.75 360.30 358.167339 357.014220 1.153119
2019-07-19 323.40 315.10 358.402790 360.822666 -2.419876
2019-07-22 312.00 310.62 352.429941 358.852909 -6.422968
2019-11-15 290.59 295.03 288.089201 287.815298 0.273902
2019-11-18 296.00 302.57 289.899300 288.393925 1.505376
2020-03-16 306.63 298.84 349.954106 351.268914 -1.314808
2020-03-17 306.18 319.75 346.178593 350.032878 -3.854285
2020-03-30 363.00 370.96 350.722116 349.847585 0.874531
2020-03-31 367.93 375.50 353.819351 350.853562 2.965789
trade_signal signal_change entry_exit
date
2019-01-08 1.0 1.0 0.0
2019-01-09 1.0 0.0 1.0
2019-05-20 0.0 -1.0 0.0
2019-05-21 0.0 0.0 -1.0
2019-06-24 1.0 1.0 0.0
2019-06-25 1.0 0.0 1.0
2019-07-19 0.0 -1.0 0.0
2019-07-22 0.0 0.0 -1.0
2019-11-15 1.0 1.0 0.0
2019-11-18 1.0 0.0 1.0
2020-03-16 0.0 -1.0 0.0
2020-03-17 0.0 0.0 -1.0
2020-03-30 1.0 1.0 0.0
2020-03-31 1.0 0.0 1.0
List the signal change and entry/exit points for EMA_030_SlowMA_50_FastMA_20
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-09 317.710 319.96 281.511745 280.389970 1.121775
2019-01-10 314.570 324.66 285.634833 282.323789 3.311045
2019-05-23 355.500 352.21 359.657839 359.704397 -0.046557
2019-05-24 355.410 354.39 359.156140 359.495472 -0.339331
2019-06-24 370.270 371.04 357.059886 356.879957 0.179929
2019-06-25 370.750 360.30 357.368469 357.014220 0.354249
2019-07-19 323.400 315.10 360.188502 360.822666 -0.634164
2019-07-22 312.000 310.62 355.467692 358.852909 -3.385217
2019-11-19 304.010 302.60 289.706483 288.951035 0.755448
2019-11-20 301.010 305.16 291.178246 289.586691 1.591555
2020-03-18 302.395 315.47 347.087172 348.677470 -1.590298
2020-03-19 324.330 332.03 345.653155 348.024627 -2.371472
2020-03-27 359.090 357.12 349.000061 348.985853 0.014208
2020-03-30 363.000 370.96 351.091484 349.847585 1.243899
trade_signal signal_change entry_exit
date
2019-01-09 1.0 1.0 0.0
2019-01-10 1.0 0.0 1.0
2019-05-23 0.0 -1.0 0.0
2019-05-24 0.0 0.0 -1.0
2019-06-24 1.0 1.0 0.0
2019-06-25 1.0 0.0 1.0
2019-07-19 0.0 -1.0 0.0
2019-07-22 0.0 0.0 -1.0
2019-11-19 1.0 1.0 0.0
2019-11-20 1.0 0.0 1.0
2020-03-18 0.0 -1.0 0.0
2020-03-19 0.0 0.0 -1.0
2020-03-27 1.0 1.0 0.0
2020-03-30 1.0 0.0 1.0
if verbose:
for key in model_collection:
graph_data = model_collection[key].copy()
title_string = "Exponential Moving Average Crossover Model for " + key
fig = plt.figure(figsize=(16,9))
ylabel = stock_symbol + ' price in $'
ax1 = fig.add_subplot(111, ylabel=ylabel, title=title_string)
graph_data['fast_ma'].plot(ax=ax1, color='b', lw=2.)
graph_data['slow_ma'].plot(ax=ax1, color='r', lw=2.)
graph_data['close_price'].plot(ax=ax1, color='g')
ax1.plot(graph_data.loc[graph_data.entry_exit == 1].index, graph_data.close_price[graph_data.entry_exit == 1], '^', markersize=7, color='k',label='buy')
ax1.plot(graph_data.loc[graph_data.entry_exit == -1].index, graph_data.close_price[graph_data.entry_exit == -1], 'v', markersize=7, color='k',label='sell')
plt.legend(loc='upper left')
plt.show()
def trading_portfolio_generation(initial_fund, trading_model):
# Construct a portfolio to track the transactions and returns
portfolio = pd.DataFrame(index=trading_model.index, columns=['trade_action', 'qty_onhand', 'cost_basis', 'sold_transaction', 'gain_loss', 'cash_onhand', 'position_value', 'total_position', 'accumu_return'])
portfolio.iloc[0]['trade_action'] = 0
portfolio.iloc[0]['qty_onhand'] = 0
portfolio.iloc[0]['cost_basis'] = 0.00
portfolio.iloc[0]['sold_transaction'] = 0.00
portfolio.iloc[0]['gain_loss'] = 0.00
portfolio.iloc[0]['cash_onhand'] = initial_capital
portfolio.iloc[0]['position_value'] = 0.00
portfolio.iloc[0]['total_position'] = initial_capital
portfolio.iloc[0]['accumu_return'] = portfolio.iloc[0]['total_position'] - initial_fund
recent_cost = 0
# The conditional parameters below determine how the trading strategy will be carried out
for i in range(1, len(portfolio)):
if (trading_model.iloc[i]['entry_exit'] == 1) and (portfolio.iloc[i-1]['qty_onhand'] == 0):
portfolio.iloc[i]['trade_action'] = 1
portfolio.iloc[i]['qty_onhand'] = portfolio.iloc[i-1]['qty_onhand'] + portfolio.iloc[i]['trade_action']
portfolio.iloc[i]['cost_basis'] = trading_model.iloc[i]['open_price'] * portfolio.iloc[i]['trade_action']
portfolio.iloc[i]['sold_transaction'] = 0.00
portfolio.iloc[i]['gain_loss'] = 0.00
portfolio.iloc[i]['cash_onhand'] = portfolio.iloc[i-1]['cash_onhand'] - portfolio.iloc[i]['cost_basis']
recent_cost = trading_model.iloc[i]['open_price'] * portfolio.iloc[i]['trade_action']
if verbose: print('BOUGHT QTY:', portfolio.iloc[i]['trade_action'], 'on', portfolio.index[i], 'at the price of', trading_model.iloc[i]['open_price'])
elif (trading_model.iloc[i]['entry_exit'] == -1) and (portfolio.iloc[i-1]['qty_onhand'] > 0):
portfolio.iloc[i]['trade_action'] = -1
portfolio.iloc[i]['qty_onhand'] = portfolio.iloc[i-1]['qty_onhand'] + portfolio.iloc[i]['trade_action']
portfolio.iloc[i]['cost_basis'] = 0.00
portfolio.iloc[i]['sold_transaction'] = trading_model.iloc[i]['open_price'] * portfolio.iloc[i]['trade_action'] * -1
portfolio.iloc[i]['gain_loss'] = (recent_cost + (trading_model.iloc[i]['open_price'] * portfolio.iloc[i]['trade_action'])) * -1
portfolio.iloc[i]['cash_onhand'] = portfolio.iloc[i-1]['cash_onhand'] + portfolio.iloc[i]['sold_transaction']
recent_cost = 0.00
if verbose: print('SOLD QTY:', portfolio.iloc[i]['trade_action'], 'on', portfolio.index[i], 'at the price of', trading_model.iloc[i]['open_price'])
else:
portfolio.iloc[i]['trade_action'] = 0
portfolio.iloc[i]['qty_onhand'] = portfolio.iloc[i-1]['qty_onhand']
portfolio.iloc[i]['cost_basis'] = portfolio.iloc[i-1]['cost_basis']
portfolio.iloc[i]['sold_transaction'] = 0.00
portfolio.iloc[i]['gain_loss'] = 0.00
portfolio.iloc[i]['cash_onhand'] = portfolio.iloc[i-1]['cash_onhand']
portfolio.iloc[i]['position_value'] = trading_model.iloc[i]['close_price'] * portfolio.iloc[i]['qty_onhand']
portfolio.iloc[i]['total_position'] = portfolio.iloc[i]['cash_onhand'] + portfolio.iloc[i]['position_value']
portfolio.iloc[i]['accumu_return'] = portfolio.iloc[i]['total_position'] - initial_fund
return portfolio
portfolio_collection = {}
# Build dataframe for reporting model performance summary
performance_summary = pd.DataFrame(columns=['model_name','return_value','return_percent'])
for key in model_collection:
print('Processing portfolio for model:', key)
portfolio_collection[key] = trading_portfolio_generation(initial_capital, model_collection[key])
trade_transactions = portfolio_collection[key][portfolio_collection[key].trade_action != 0]
print(trade_transactions)
print('Accumulated profit/loss for one share of stock with initial capital of $%.0f at the end of modeling period: $%.2f' % (initial_capital, portfolio_collection[key].accumu_return[-1]))
if initial_capital != 0:
return_percentage = portfolio_collection[key].accumu_return[-1] / initial_capital * 100
print('Accumulated return percentage based on the initial capital investment: %.2f%%' % (return_percentage))
else:
return_percentage = None
if trade_transactions.iloc[-1]['trade_action'] == 1:
print('The current status of the model is:', 'Holding a position since', trade_transactions.index.tolist()[-1], '\n')
else:
print('The current status of the model is:', 'Waiting to enter since', trade_transactions.index.tolist()[-1], '\n')
performance_summary = performance_summary.append({'model_name': key, 'return_value': portfolio_collection[key].accumu_return[-1],
'return_percent': return_percentage}, ignore_index=True)
Processing portfolio for model: EMA_001_SlowMA_10_FastMA_05
BOUGHT QTY: 1 on 2019-03-14 00:00:00 at the price of 360.5
SOLD QTY: -1 on 2019-03-28 00:00:00 at the price of 354.485
BOUGHT QTY: 1 on 2019-04-03 00:00:00 at the price of 369.26
SOLD QTY: -1 on 2019-04-15 00:00:00 at the price of 350.71
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-09 00:00:00 at the price of 360.9
BOUGHT QTY: 1 on 2019-06-07 00:00:00 at the price of 357.39
SOLD QTY: -1 on 2019-06-13 00:00:00 at the price of 347.23
BOUGHT QTY: 1 on 2019-06-19 00:00:00 at the price of 361.72
SOLD QTY: -1 on 2019-07-16 00:00:00 at the price of 370.09
BOUGHT QTY: 1 on 2019-09-18 00:00:00 at the price of 294.99
SOLD QTY: -1 on 2019-09-20 00:00:00 at the price of 280.26
BOUGHT QTY: 1 on 2019-10-11 00:00:00 at the price of 284.8
SOLD QTY: -1 on 2019-10-23 00:00:00 at the price of 268.06
BOUGHT QTY: 1 on 2019-10-29 00:00:00 at the price of 281.87
SOLD QTY: -1 on 2019-12-06 00:00:00 at the price of 304.7
BOUGHT QTY: 1 on 2019-12-18 00:00:00 at the price of 316.26
SOLD QTY: -1 on 2020-01-23 00:00:00 at the price of 326.04
BOUGHT QTY: 1 on 2020-01-24 00:00:00 at the price of 348.46
SOLD QTY: -1 on 2020-02-26 00:00:00 at the price of 366.31
BOUGHT QTY: 1 on 2020-03-03 00:00:00 at the price of 381.03
SOLD QTY: -1 on 2020-03-04 00:00:00 at the price of 377.77
BOUGHT QTY: 1 on 2020-03-05 00:00:00 at the price of 381.0
SOLD QTY: -1 on 2020-03-09 00:00:00 at the price of 343.86
BOUGHT QTY: 1 on 2020-03-24 00:00:00 at the price of 369.99
SOLD QTY: -1 on 2020-05-26 00:00:00 at the price of 427.77
BOUGHT QTY: 1 on 2020-06-10 00:00:00 at the price of 436.0
SOLD QTY: -1 on 2020-06-15 00:00:00 at the price of 421.4
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-03-14 1 1 360.5 0 0
2019-03-28 -1 0 0 354.485 -6.015
2019-04-03 1 1 369.26 0 0
2019-04-15 -1 0 0 350.71 -18.55
2019-04-23 1 1 375.45 0 0
2019-05-09 -1 0 0 360.9 -14.55
2019-06-07 1 1 357.39 0 0
2019-06-13 -1 0 0 347.23 -10.16
2019-06-19 1 1 361.72 0 0
2019-07-16 -1 0 0 370.09 8.37
2019-09-18 1 1 294.99 0 0
2019-09-20 -1 0 0 280.26 -14.73
2019-10-11 1 1 284.8 0 0
2019-10-23 -1 0 0 268.06 -16.74
2019-10-29 1 1 281.87 0 0
2019-12-06 -1 0 0 304.7 22.83
2019-12-18 1 1 316.26 0 0
2020-01-23 -1 0 0 326.04 9.78
2020-01-24 1 1 348.46 0 0
2020-02-26 -1 0 0 366.31 17.85
2020-03-03 1 1 381.03 0 0
2020-03-04 -1 0 0 377.77 -3.26
2020-03-05 1 1 381 0 0
2020-03-09 -1 0 0 343.86 -37.14
2020-03-24 1 1 369.99 0 0
2020-05-26 -1 0 0 427.77 57.78
2020-06-10 1 1 436 0 0
2020-06-15 -1 0 0 421.4 -14.6
2020-06-17 1 1 441.82 0 0
cash_onhand position_value total_position accumu_return
date
2019-03-14 -360.5 358.82 -1.68 -1.68
2019-03-28 -6.015 0 -6.015 -6.015
2019-04-03 -375.275 369.75 -5.525 -5.525
2019-04-15 -24.565 0 -24.565 -24.565
2019-04-23 -400.015 381.89 -18.125 -18.125
2019-05-09 -39.115 0 -39.115 -39.115
2019-06-07 -396.505 360.87 -35.635 -35.635
2019-06-13 -49.275 0 -49.275 -49.275
2019-06-19 -410.995 363.52 -47.475 -47.475
2019-07-16 -40.905 0 -40.905 -40.905
2019-09-18 -335.895 291.56 -44.335 -44.335
2019-09-20 -55.635 0 -55.635 -55.635
2019-10-11 -340.435 282.93 -57.505 -57.505
2019-10-23 -72.375 0 -72.375 -72.375
2019-10-29 -354.245 281.21 -73.035 -73.035
2019-12-06 -49.545 0 -49.545 -49.545
2019-12-18 -365.805 320.8 -45.005 -45.005
2020-01-23 -39.765 0 -39.765 -39.765
2020-01-24 -388.225 353.16 -35.065 -35.065
2020-02-26 -21.915 0 -21.915 -21.915
2020-03-03 -402.945 368.77 -34.175 -34.175
2020-03-04 -25.175 0 -25.175 -25.175
2020-03-05 -406.175 372.78 -33.395 -33.395
2020-03-09 -62.315 0 -62.315 -62.315
2020-03-24 -432.305 357.32 -74.985 -74.985
2020-05-26 -4.535 0 -4.535 -4.535
2020-06-10 -440.535 434.48 -6.055 -6.055
2020-06-15 -19.135 0 -19.135 -19.135
2020-06-17 -460.955 447.77 -13.185 -13.185
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $-13.72
The current status of the model is: Holding a position since 2020-06-17 00:00:00
Processing portfolio for model: EMA_002_SlowMA_15_FastMA_05
BOUGHT QTY: 1 on 2019-01-04 00:00:00 at the price of 281.88
SOLD QTY: -1 on 2019-03-08 00:00:00 at the price of 345.75
BOUGHT QTY: 1 on 2019-03-13 00:00:00 at the price of 355.81
SOLD QTY: -1 on 2019-03-28 00:00:00 at the price of 354.485
BOUGHT QTY: 1 on 2019-04-02 00:00:00 at the price of 366.25
SOLD QTY: -1 on 2019-04-15 00:00:00 at the price of 350.71
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-10 00:00:00 at the price of 361.62
BOUGHT QTY: 1 on 2019-06-10 00:00:00 at the price of 363.65
SOLD QTY: -1 on 2019-06-12 00:00:00 at the price of 351.82
BOUGHT QTY: 1 on 2019-06-20 00:00:00 at the price of 365.91
SOLD QTY: -1 on 2019-07-17 00:00:00 at the price of 366.25
BOUGHT QTY: 1 on 2019-09-18 00:00:00 at the price of 294.99
SOLD QTY: -1 on 2019-09-19 00:00:00 at the price of 291.56
BOUGHT QTY: 1 on 2019-10-11 00:00:00 at the price of 284.8
SOLD QTY: -1 on 2019-10-23 00:00:00 at the price of 268.06
BOUGHT QTY: 1 on 2019-10-29 00:00:00 at the price of 281.87
SOLD QTY: -1 on 2019-12-11 00:00:00 at the price of 294.49
BOUGHT QTY: 1 on 2019-12-18 00:00:00 at the price of 316.26
SOLD QTY: -1 on 2020-03-10 00:00:00 at the price of 356.425
BOUGHT QTY: 1 on 2020-03-25 00:00:00 at the price of 361.02
SOLD QTY: -1 on 2020-03-26 00:00:00 at the price of 344.0
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
SOLD QTY: -1 on 2020-05-27 00:00:00 at the price of 410.38
BOUGHT QTY: 1 on 2020-06-11 00:00:00 at the price of 428.2
SOLD QTY: -1 on 2020-06-15 00:00:00 at the price of 421.4
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-04 1 1 281.88 0 0
2019-03-08 -1 0 0 345.75 63.87
2019-03-13 1 1 355.81 0 0
2019-03-28 -1 0 0 354.485 -1.325
2019-04-02 1 1 366.25 0 0
2019-04-15 -1 0 0 350.71 -15.54
2019-04-23 1 1 375.45 0 0
2019-05-10 -1 0 0 361.62 -13.83
2019-06-10 1 1 363.65 0 0
2019-06-12 -1 0 0 351.82 -11.83
2019-06-20 1 1 365.91 0 0
2019-07-17 -1 0 0 366.25 0.34
2019-09-18 1 1 294.99 0 0
2019-09-19 -1 0 0 291.56 -3.43
2019-10-11 1 1 284.8 0 0
2019-10-23 -1 0 0 268.06 -16.74
2019-10-29 1 1 281.87 0 0
2019-12-11 -1 0 0 294.49 12.62
2019-12-18 1 1 316.26 0 0
2020-03-10 -1 0 0 356.425 40.165
2020-03-25 1 1 361.02 0 0
2020-03-26 -1 0 0 344 -17.02
2020-03-27 1 1 359.09 0 0
2020-05-27 -1 0 0 410.38 51.29
2020-06-11 1 1 428.2 0 0
2020-06-15 -1 0 0 421.4 -6.8
2020-06-17 1 1 441.82 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-04 -281.88 297.57 15.69 15.69
2019-03-08 63.87 0 63.87 63.87
2019-03-13 -291.94 361.21 69.27 69.27
2019-03-28 62.545 0 62.545 62.545
2019-04-02 -303.705 367.72 64.015 64.015
2019-04-15 47.005 0 47.005 47.005
2019-04-23 -328.445 381.89 53.445 53.445
2019-05-10 33.175 0 33.175 33.175
2019-06-10 -330.475 352.01 21.535 21.535
2019-06-12 21.345 0 21.345 21.345
2019-06-20 -344.565 365.21 20.645 20.645
2019-07-17 21.685 0 21.685 21.685
2019-09-18 -273.305 291.56 18.255 18.255
2019-09-19 18.255 0 18.255 18.255
2019-10-11 -266.545 282.93 16.385 16.385
2019-10-23 1.515 0 1.515 1.515
2019-10-29 -280.355 281.21 0.855 0.855
2019-12-11 14.135 0 14.135 14.135
2019-12-18 -302.125 320.8 18.675 18.675
2020-03-10 54.3 0 54.3 54.3
2020-03-25 -306.72 342.39 35.67 35.67
2020-03-26 37.28 0 37.28 37.28
2020-03-27 -321.81 357.12 35.31 35.31
2020-05-27 88.57 0 88.57 88.57
2020-06-11 -339.63 425.56 85.93 85.93
2020-06-15 81.77 0 81.77 81.77
2020-06-17 -360.05 447.77 87.72 87.72
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $87.19
The current status of the model is: Holding a position since 2020-06-17 00:00:00
Processing portfolio for model: EMA_003_SlowMA_15_FastMA_10
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-04-01 00:00:00 at the price of 359.0
BOUGHT QTY: 1 on 2019-04-02 00:00:00 at the price of 366.25
SOLD QTY: -1 on 2019-04-15 00:00:00 at the price of 350.71
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-13 00:00:00 at the price of 352.29
BOUGHT QTY: 1 on 2019-06-20 00:00:00 at the price of 365.91
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-15 00:00:00 at the price of 283.82
SOLD QTY: -1 on 2019-10-24 00:00:00 at the price of 271.81
BOUGHT QTY: 1 on 2019-10-30 00:00:00 at the price of 284.34
SOLD QTY: -1 on 2019-12-12 00:00:00 at the price of 295.67
BOUGHT QTY: 1 on 2019-12-18 00:00:00 at the price of 316.26
SOLD QTY: -1 on 2020-03-10 00:00:00 at the price of 356.425
BOUGHT QTY: 1 on 2020-03-30 00:00:00 at the price of 363.0
SOLD QTY: -1 on 2020-05-29 00:00:00 at the price of 417.46
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-07 1 1 302.1 0 0
2019-04-01 -1 0 0 359 56.9
2019-04-02 1 1 366.25 0 0
2019-04-15 -1 0 0 350.71 -15.54
2019-04-23 1 1 375.45 0 0
2019-05-13 -1 0 0 352.29 -23.16
2019-06-20 1 1 365.91 0 0
2019-07-19 -1 0 0 323.4 -42.51
2019-10-15 1 1 283.82 0 0
2019-10-24 -1 0 0 271.81 -12.01
2019-10-30 1 1 284.34 0 0
2019-12-12 -1 0 0 295.67 11.33
2019-12-18 1 1 316.26 0 0
2020-03-10 -1 0 0 356.425 40.165
2020-03-30 1 1 363 0 0
2020-05-29 -1 0 0 417.46 54.46
2020-06-17 1 1 441.82 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-07 -302.1 315.34 13.24 13.24
2019-04-01 56.9 0 56.9 56.9
2019-04-02 -309.35 367.72 58.37 58.37
2019-04-15 41.36 0 41.36 41.36
2019-04-23 -334.09 381.89 47.8 47.8
2019-05-13 18.2 0 18.2 18.2
2019-06-20 -347.71 365.21 17.5 17.5
2019-07-19 -24.31 0 -24.31 -24.31
2019-10-15 -308.13 284.25 -23.88 -23.88
2019-10-24 -36.32 0 -36.32 -36.32
2019-10-30 -320.66 291.45 -29.21 -29.21
2019-12-12 -24.99 0 -24.99 -24.99
2019-12-18 -341.25 320.8 -20.45 -20.45
2020-03-10 15.175 0 15.175 15.175
2020-03-30 -347.825 370.96 23.135 23.135
2020-05-29 69.635 0 69.635 69.635
2020-06-17 -372.185 447.77 75.585 75.585
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $75.06
The current status of the model is: Holding a position since 2020-06-17 00:00:00
Processing portfolio for model: EMA_004_SlowMA_20_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-03-29 00:00:00 at the price of 357.16
BOUGHT QTY: 1 on 2019-04-02 00:00:00 at the price of 366.25
SOLD QTY: -1 on 2019-04-15 00:00:00 at the price of 350.71
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-10 00:00:00 at the price of 361.62
BOUGHT QTY: 1 on 2019-06-10 00:00:00 at the price of 363.65
SOLD QTY: -1 on 2019-06-11 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-06-20 00:00:00 at the price of 365.91
SOLD QTY: -1 on 2019-07-18 00:00:00 at the price of 323.76
BOUGHT QTY: 1 on 2019-10-14 00:00:00 at the price of 283.93
SOLD QTY: -1 on 2019-10-23 00:00:00 at the price of 268.06
BOUGHT QTY: 1 on 2019-10-30 00:00:00 at the price of 284.34
SOLD QTY: -1 on 2019-12-11 00:00:00 at the price of 294.49
BOUGHT QTY: 1 on 2019-12-18 00:00:00 at the price of 316.26
SOLD QTY: -1 on 2020-03-10 00:00:00 at the price of 356.425
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
SOLD QTY: -1 on 2020-05-27 00:00:00 at the price of 410.38
BOUGHT QTY: 1 on 2020-06-11 00:00:00 at the price of 428.2
SOLD QTY: -1 on 2020-06-15 00:00:00 at the price of 421.4
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-07 1 1 302.1 0 0
2019-03-29 -1 0 0 357.16 55.06
2019-04-02 1 1 366.25 0 0
2019-04-15 -1 0 0 350.71 -15.54
2019-04-23 1 1 375.45 0 0
2019-05-10 -1 0 0 361.62 -13.83
2019-06-10 1 1 363.65 0 0
2019-06-11 -1 0 0 355 -8.65
2019-06-20 1 1 365.91 0 0
2019-07-18 -1 0 0 323.76 -42.15
2019-10-14 1 1 283.93 0 0
2019-10-23 -1 0 0 268.06 -15.87
2019-10-30 1 1 284.34 0 0
2019-12-11 -1 0 0 294.49 10.15
2019-12-18 1 1 316.26 0 0
2020-03-10 -1 0 0 356.425 40.165
2020-03-27 1 1 359.09 0 0
2020-05-27 -1 0 0 410.38 51.29
2020-06-11 1 1 428.2 0 0
2020-06-15 -1 0 0 421.4 -6.8
2020-06-17 1 1 441.82 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-07 -302.1 315.34 13.24 13.24
2019-03-29 55.06 0 55.06 55.06
2019-04-02 -311.19 367.72 56.53 56.53
2019-04-15 39.52 0 39.52 39.52
2019-04-23 -335.93 381.89 45.96 45.96
2019-05-10 25.69 0 25.69 25.69
2019-06-10 -337.96 352.01 14.05 14.05
2019-06-11 17.04 0 17.04 17.04
2019-06-20 -348.87 365.21 16.34 16.34
2019-07-18 -25.11 0 -25.11 -25.11
2019-10-14 -309.04 285.53 -23.51 -23.51
2019-10-23 -40.98 0 -40.98 -40.98
2019-10-30 -325.32 291.45 -33.87 -33.87
2019-12-11 -30.83 0 -30.83 -30.83
2019-12-18 -347.09 320.8 -26.29 -26.29
2020-03-10 9.335 0 9.335 9.335
2020-03-27 -349.755 357.12 7.365 7.365
2020-05-27 60.625 0 60.625 60.625
2020-06-11 -367.575 425.56 57.985 57.985
2020-06-15 53.825 0 53.825 53.825
2020-06-17 -387.995 447.77 59.775 59.775
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $59.25
The current status of the model is: Holding a position since 2020-06-17 00:00:00
Processing portfolio for model: EMA_005_SlowMA_20_FastMA_10
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-04-16 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-21 00:00:00 at the price of 365.0
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-16 00:00:00 at the price of 283.12
SOLD QTY: -1 on 2019-10-23 00:00:00 at the price of 268.06
BOUGHT QTY: 1 on 2019-10-31 00:00:00 at the price of 291.0
SOLD QTY: -1 on 2020-03-10 00:00:00 at the price of 356.425
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
SOLD QTY: -1 on 2020-06-01 00:00:00 at the price of 418.83
BOUGHT QTY: 1 on 2020-06-11 00:00:00 at the price of 428.2
SOLD QTY: -1 on 2020-06-12 00:00:00 at the price of 429.0
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-07 1 1 302.1 0 0
2019-04-16 -1 0 0 355 52.9
2019-04-23 1 1 375.45 0 0
2019-05-14 -1 0 0 348.71 -26.74
2019-06-21 1 1 365 0 0
2019-07-19 -1 0 0 323.4 -41.6
2019-10-16 1 1 283.12 0 0
2019-10-23 -1 0 0 268.06 -15.06
2019-10-31 1 1 291 0 0
2020-03-10 -1 0 0 356.425 65.425
2020-03-31 1 1 367.93 0 0
2020-06-01 -1 0 0 418.83 50.9
2020-06-11 1 1 428.2 0 0
2020-06-12 -1 0 0 429 0.8
2020-06-17 1 1 441.82 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-07 -302.1 315.34 13.24 13.24
2019-04-16 52.9 0 52.9 52.9
2019-04-23 -322.55 381.89 59.34 59.34
2019-05-14 26.16 0 26.16 26.16
2019-06-21 -338.84 369.21 30.37 30.37
2019-07-19 -15.44 0 -15.44 -15.44
2019-10-16 -298.56 286.28 -12.28 -12.28
2019-10-23 -30.5 0 -30.5 -30.5
2019-10-31 -321.5 287.41 -34.09 -34.09
2020-03-10 34.925 0 34.925 34.925
2020-03-31 -333.005 375.5 42.495 42.495
2020-06-01 85.825 0 85.825 85.825
2020-06-11 -342.375 425.56 83.185 83.185
2020-06-12 86.625 0 86.625 86.625
2020-06-17 -355.195 447.77 92.575 92.575
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $92.04
The current status of the model is: Holding a position since 2020-06-17 00:00:00
Processing portfolio for model: EMA_006_SlowMA_20_FastMA_15
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-04-16 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-18 00:00:00 at the price of 289.36
SOLD QTY: -1 on 2019-10-21 00:00:00 at the price of 272.89
BOUGHT QTY: 1 on 2019-10-31 00:00:00 at the price of 291.0
SOLD QTY: -1 on 2020-03-12 00:00:00 at the price of 326.5
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
SOLD QTY: -1 on 2020-06-05 00:00:00 at the price of 407.29
BOUGHT QTY: 1 on 2020-06-11 00:00:00 at the price of 428.2
SOLD QTY: -1 on 2020-06-15 00:00:00 at the price of 421.4
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-08 1 1 319.98 0 0
2019-04-16 -1 0 0 355 35.02
2019-04-23 1 1 375.45 0 0
2019-05-14 -1 0 0 348.71 -26.74
2019-06-24 1 1 370.27 0 0
2019-07-19 -1 0 0 323.4 -46.87
2019-10-18 1 1 289.36 0 0
2019-10-21 -1 0 0 272.89 -16.47
2019-10-31 1 1 291 0 0
2020-03-12 -1 0 0 326.5 35.5
2020-04-01 1 1 376.05 0 0
2020-06-05 -1 0 0 407.29 31.24
2020-06-11 1 1 428.2 0 0
2020-06-15 -1 0 0 421.4 -6.8
2020-06-17 1 1 441.82 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-08 -319.98 320.27 0.29 0.29
2019-04-16 35.02 0 35.02 35.02
2019-04-23 -340.43 381.89 41.46 41.46
2019-05-14 8.28 0 8.28 8.28
2019-06-24 -361.99 371.04 9.05 9.05
2019-07-19 -38.59 0 -38.59 -38.59
2019-10-18 -327.95 275.3 -52.65 -52.65
2019-10-21 -55.06 0 -55.06 -55.06
2019-10-31 -346.06 287.41 -58.65 -58.65
2020-03-12 -19.56 0 -19.56 -19.56
2020-04-01 -395.61 364.08 -31.53 -31.53
2020-06-05 11.68 0 11.68 11.68
2020-06-11 -416.52 425.56 9.04 9.04
2020-06-15 4.88 0 4.88 4.88
2020-06-17 -436.94 447.77 10.83 10.83
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $10.30
The current status of the model is: Holding a position since 2020-06-17 00:00:00
Processing portfolio for model: EMA_007_SlowMA_25_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-04-01 00:00:00 at the price of 359.0
BOUGHT QTY: 1 on 2019-04-02 00:00:00 at the price of 366.25
SOLD QTY: -1 on 2019-04-15 00:00:00 at the price of 350.71
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-13 00:00:00 at the price of 352.29
BOUGHT QTY: 1 on 2019-06-20 00:00:00 at the price of 365.91
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-15 00:00:00 at the price of 283.82
SOLD QTY: -1 on 2019-10-23 00:00:00 at the price of 268.06
BOUGHT QTY: 1 on 2019-10-30 00:00:00 at the price of 284.34
SOLD QTY: -1 on 2019-12-12 00:00:00 at the price of 295.67
BOUGHT QTY: 1 on 2019-12-17 00:00:00 at the price of 307.36
SOLD QTY: -1 on 2020-03-10 00:00:00 at the price of 356.425
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
SOLD QTY: -1 on 2020-05-29 00:00:00 at the price of 417.46
BOUGHT QTY: 1 on 2020-06-10 00:00:00 at the price of 436.0
SOLD QTY: -1 on 2020-06-15 00:00:00 at the price of 421.4
BOUGHT QTY: 1 on 2020-06-17 00:00:00 at the price of 441.82
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-07 1 1 302.1 0 0
2019-04-01 -1 0 0 359 56.9
2019-04-02 1 1 366.25 0 0
2019-04-15 -1 0 0 350.71 -15.54
2019-04-23 1 1 375.45 0 0
2019-05-13 -1 0 0 352.29 -23.16
2019-06-20 1 1 365.91 0 0
2019-07-19 -1 0 0 323.4 -42.51
2019-10-15 1 1 283.82 0 0
2019-10-23 -1 0 0 268.06 -15.76
2019-10-30 1 1 284.34 0 0
2019-12-12 -1 0 0 295.67 11.33
2019-12-17 1 1 307.36 0 0
2020-03-10 -1 0 0 356.425 49.065
2020-03-27 1 1 359.09 0 0
2020-05-29 -1 0 0 417.46 58.37
2020-06-10 1 1 436 0 0
2020-06-15 -1 0 0 421.4 -14.6
2020-06-17 1 1 441.82 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-07 -302.1 315.34 13.24 13.24
2019-04-01 56.9 0 56.9 56.9
2019-04-02 -309.35 367.72 58.37 58.37
2019-04-15 41.36 0 41.36 41.36
2019-04-23 -334.09 381.89 47.8 47.8
2019-05-13 18.2 0 18.2 18.2
2019-06-20 -347.71 365.21 17.5 17.5
2019-07-19 -24.31 0 -24.31 -24.31
2019-10-15 -308.13 284.25 -23.88 -23.88
2019-10-23 -40.07 0 -40.07 -40.07
2019-10-30 -324.41 291.45 -32.96 -32.96
2019-12-12 -28.74 0 -28.74 -28.74
2019-12-17 -336.1 315.48 -20.62 -20.62
2020-03-10 20.325 0 20.325 20.325
2020-03-27 -338.765 357.12 18.355 18.355
2020-05-29 78.695 0 78.695 78.695
2020-06-10 -357.305 434.48 77.175 77.175
2020-06-15 64.095 0 64.095 64.095
2020-06-17 -377.725 447.77 70.045 70.045
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $69.51
The current status of the model is: Holding a position since 2020-06-17 00:00:00
Processing portfolio for model: EMA_008_SlowMA_25_FastMA_10
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-04-16 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-21 00:00:00 at the price of 365.0
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-18 00:00:00 at the price of 289.36
SOLD QTY: -1 on 2019-10-23 00:00:00 at the price of 268.06
BOUGHT QTY: 1 on 2019-10-31 00:00:00 at the price of 291.0
SOLD QTY: -1 on 2020-03-12 00:00:00 at the price of 326.5
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
SOLD QTY: -1 on 2020-06-05 00:00:00 at the price of 407.29
BOUGHT QTY: 1 on 2020-06-11 00:00:00 at the price of 428.2
SOLD QTY: -1 on 2020-06-15 00:00:00 at the price of 421.4
BOUGHT QTY: 1 on 2020-06-16 00:00:00 at the price of 425.76
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-08 1 1 319.98 0 0
2019-04-16 -1 0 0 355 35.02
2019-04-23 1 1 375.45 0 0
2019-05-14 -1 0 0 348.71 -26.74
2019-06-21 1 1 365 0 0
2019-07-19 -1 0 0 323.4 -41.6
2019-10-18 1 1 289.36 0 0
2019-10-23 -1 0 0 268.06 -21.3
2019-10-31 1 1 291 0 0
2020-03-12 -1 0 0 326.5 35.5
2020-03-31 1 1 367.93 0 0
2020-06-05 -1 0 0 407.29 39.36
2020-06-11 1 1 428.2 0 0
2020-06-15 -1 0 0 421.4 -6.8
2020-06-16 1 1 425.76 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-08 -319.98 320.27 0.29 0.29
2019-04-16 35.02 0 35.02 35.02
2019-04-23 -340.43 381.89 41.46 41.46
2019-05-14 8.28 0 8.28 8.28
2019-06-21 -356.72 369.21 12.49 12.49
2019-07-19 -33.32 0 -33.32 -33.32
2019-10-18 -322.68 275.3 -47.38 -47.38
2019-10-23 -54.62 0 -54.62 -54.62
2019-10-31 -345.62 287.41 -58.21 -58.21
2020-03-12 -19.12 0 -19.12 -19.12
2020-03-31 -387.05 375.5 -11.55 -11.55
2020-06-05 20.24 0 20.24 20.24
2020-06-11 -407.96 425.56 17.6 17.6
2020-06-15 13.44 0 13.44 13.44
2020-06-16 -412.32 436.13 23.81 23.81
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $34.92
The current status of the model is: Holding a position since 2020-06-16 00:00:00
Processing portfolio for model: EMA_009_SlowMA_25_FastMA_15
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-04-18 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-22 00:00:00 at the price of 359.7
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-01 00:00:00 at the price of 288.7
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-08 1 1 319.98 0 0
2019-04-18 -1 0 0 355 35.02
2019-04-22 1 1 359.7 0 0
2019-05-14 -1 0 0 348.71 -10.99
2019-06-24 1 1 370.27 0 0
2019-07-19 -1 0 0 323.4 -46.87
2019-11-01 1 1 288.7 0 0
2020-03-13 -1 0 0 330.51 41.81
2020-04-01 1 1 376.05 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-08 -319.98 320.27 0.29 0.29
2019-04-18 35.02 0 35.02 35.02
2019-04-22 -324.68 377.34 52.66 52.66
2019-05-14 24.03 0 24.03 24.03
2019-06-24 -346.24 371.04 24.8 24.8
2019-07-19 -22.84 0 -22.84 -22.84
2019-11-01 -311.54 286.81 -24.73 -24.73
2020-03-13 18.97 0 18.97 18.97
2020-04-01 -357.08 364.08 7 7
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $90.16
The current status of the model is: Holding a position since 2020-04-01 00:00:00
Processing portfolio for model: EMA_010_SlowMA_25_FastMA_20
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-15 00:00:00 at the price of 343.34
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-05 00:00:00 at the price of 289.99
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-04-02 00:00:00 at the price of 364.08
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-09 1 1 317.71 0 0
2019-05-15 -1 0 0 343.34 25.63
2019-06-25 1 1 370.75 0 0
2019-07-22 -1 0 0 312 -58.75
2019-11-05 1 1 289.99 0 0
2020-03-13 -1 0 0 330.51 40.52
2020-04-02 1 1 364.08 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-09 -317.71 319.96 2.25 2.25
2019-05-15 25.63 0 25.63 25.63
2019-06-25 -345.12 360.3 15.18 15.18
2019-07-22 -33.12 0 -33.12 -33.12
2019-11-05 -323.11 288.03 -35.08 -35.08
2020-03-13 7.4 0 7.4 7.4
2020-04-02 -356.68 370.08 13.4 13.4
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $90.56
The current status of the model is: Holding a position since 2020-04-02 00:00:00
Processing portfolio for model: EMA_011_SlowMA_30_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-04-16 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-13 00:00:00 at the price of 352.29
BOUGHT QTY: 1 on 2019-06-20 00:00:00 at the price of 365.91
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-16 00:00:00 at the price of 283.12
SOLD QTY: -1 on 2019-10-22 00:00:00 at the price of 271.159
BOUGHT QTY: 1 on 2019-10-31 00:00:00 at the price of 291.0
SOLD QTY: -1 on 2020-03-10 00:00:00 at the price of 356.425
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
SOLD QTY: -1 on 2020-05-29 00:00:00 at the price of 417.46
BOUGHT QTY: 1 on 2020-06-02 00:00:00 at the price of 425.87
SOLD QTY: -1 on 2020-06-05 00:00:00 at the price of 407.29
BOUGHT QTY: 1 on 2020-06-10 00:00:00 at the price of 436.0
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-07 1 1 302.1 0 0
2019-04-16 -1 0 0 355 52.9
2019-04-23 1 1 375.45 0 0
2019-05-13 -1 0 0 352.29 -23.16
2019-06-20 1 1 365.91 0 0
2019-07-19 -1 0 0 323.4 -42.51
2019-10-16 1 1 283.12 0 0
2019-10-22 -1 0 0 271.159 -11.961
2019-10-31 1 1 291 0 0
2020-03-10 -1 0 0 356.425 65.425
2020-03-27 1 1 359.09 0 0
2020-05-29 -1 0 0 417.46 58.37
2020-06-02 1 1 425.87 0 0
2020-06-05 -1 0 0 407.29 -18.58
2020-06-10 1 1 436 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-07 -302.1 315.34 13.24 13.24
2019-04-16 52.9 0 52.9 52.9
2019-04-23 -322.55 381.89 59.34 59.34
2019-05-13 29.74 0 29.74 29.74
2019-06-20 -336.17 365.21 29.04 29.04
2019-07-19 -12.77 0 -12.77 -12.77
2019-10-16 -295.89 286.28 -9.61 -9.61
2019-10-22 -24.731 0 -24.731 -24.731
2019-10-31 -315.731 287.41 -28.321 -28.321
2020-03-10 40.694 0 40.694 40.694
2020-03-27 -318.396 357.12 38.724 38.724
2020-05-29 99.064 0 99.064 99.064
2020-06-02 -326.806 427.31 100.504 100.504
2020-06-05 80.484 0 80.484 80.484
2020-06-10 -355.516 434.48 78.964 78.964
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $91.72
The current status of the model is: Holding a position since 2020-06-10 00:00:00
Processing portfolio for model: EMA_012_SlowMA_30_FastMA_10
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-04-18 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-01 00:00:00 at the price of 288.7
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-08 1 1 319.98 0 0
2019-04-18 -1 0 0 355 35.02
2019-04-23 1 1 375.45 0 0
2019-05-14 -1 0 0 348.71 -26.74
2019-06-24 1 1 370.27 0 0
2019-07-19 -1 0 0 323.4 -46.87
2019-11-01 1 1 288.7 0 0
2020-03-13 -1 0 0 330.51 41.81
2020-03-31 1 1 367.93 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-08 -319.98 320.27 0.29 0.29
2019-04-18 35.02 0 35.02 35.02
2019-04-23 -340.43 381.89 41.46 41.46
2019-05-14 8.28 0 8.28 8.28
2019-06-24 -361.99 371.04 9.05 9.05
2019-07-19 -38.59 0 -38.59 -38.59
2019-11-01 -327.29 286.81 -40.48 -40.48
2020-03-13 3.22 0 3.22 3.22
2020-03-31 -364.71 375.5 10.79 10.79
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $82.53
The current status of the model is: Holding a position since 2020-03-31 00:00:00
Processing portfolio for model: EMA_013_SlowMA_30_FastMA_15
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-05-15 00:00:00 at the price of 343.34
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-05 00:00:00 at the price of 289.99
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-08 1 1 319.98 0 0
2019-05-15 -1 0 0 343.34 23.36
2019-06-24 1 1 370.27 0 0
2019-07-22 -1 0 0 312 -58.27
2019-11-05 1 1 289.99 0 0
2020-03-13 -1 0 0 330.51 40.52
2020-04-01 1 1 376.05 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-08 -319.98 320.27 0.29 0.29
2019-05-15 23.36 0 23.36 23.36
2019-06-24 -346.91 371.04 24.13 24.13
2019-07-22 -34.91 0 -34.91 -34.91
2019-11-05 -324.9 288.03 -36.87 -36.87
2020-03-13 5.61 0 5.61 5.61
2020-04-01 -370.44 364.08 -6.36 -6.36
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $76.80
The current status of the model is: Holding a position since 2020-04-01 00:00:00
Processing portfolio for model: EMA_014_SlowMA_30_FastMA_20
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-16 00:00:00 at the price of 356.37
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-07 00:00:00 at the price of 290.7
SOLD QTY: -1 on 2020-03-17 00:00:00 at the price of 306.18
BOUGHT QTY: 1 on 2020-04-02 00:00:00 at the price of 364.08
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-09 1 1 317.71 0 0
2019-05-16 -1 0 0 356.37 38.66
2019-06-25 1 1 370.75 0 0
2019-07-22 -1 0 0 312 -58.75
2019-11-07 1 1 290.7 0 0
2020-03-17 -1 0 0 306.18 15.48
2020-04-02 1 1 364.08 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-09 -317.71 319.96 2.25 2.25
2019-05-16 38.66 0 38.66 38.66
2019-06-25 -332.09 360.3 28.21 28.21
2019-07-22 -20.09 0 -20.09 -20.09
2019-11-07 -310.79 289.57 -21.22 -21.22
2020-03-17 -4.61 0 -4.61 -4.61
2020-04-02 -368.69 370.08 1.39 1.39
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $78.55
The current status of the model is: Holding a position since 2020-04-02 00:00:00
Processing portfolio for model: EMA_015_SlowMA_35_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-04-16 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-23 00:00:00 at the price of 375.45
SOLD QTY: -1 on 2019-05-13 00:00:00 at the price of 352.29
BOUGHT QTY: 1 on 2019-06-21 00:00:00 at the price of 365.0
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-18 00:00:00 at the price of 289.36
SOLD QTY: -1 on 2019-10-21 00:00:00 at the price of 272.89
BOUGHT QTY: 1 on 2019-10-31 00:00:00 at the price of 291.0
SOLD QTY: -1 on 2020-03-12 00:00:00 at the price of 326.5
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
SOLD QTY: -1 on 2020-06-08 00:00:00 at the price of 416.0
BOUGHT QTY: 1 on 2020-06-10 00:00:00 at the price of 436.0
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-07 1 1 302.1 0 0
2019-04-16 -1 0 0 355 52.9
2019-04-23 1 1 375.45 0 0
2019-05-13 -1 0 0 352.29 -23.16
2019-06-21 1 1 365 0 0
2019-07-19 -1 0 0 323.4 -41.6
2019-10-18 1 1 289.36 0 0
2019-10-21 -1 0 0 272.89 -16.47
2019-10-31 1 1 291 0 0
2020-03-12 -1 0 0 326.5 35.5
2020-03-27 1 1 359.09 0 0
2020-06-08 -1 0 0 416 56.91
2020-06-10 1 1 436 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-07 -302.1 315.34 13.24 13.24
2019-04-16 52.9 0 52.9 52.9
2019-04-23 -322.55 381.89 59.34 59.34
2019-05-13 29.74 0 29.74 29.74
2019-06-21 -335.26 369.21 33.95 33.95
2019-07-19 -11.86 0 -11.86 -11.86
2019-10-18 -301.22 275.3 -25.92 -25.92
2019-10-21 -28.33 0 -28.33 -28.33
2019-10-31 -319.33 287.41 -31.92 -31.92
2020-03-12 7.17 0 7.17 7.17
2020-03-27 -351.92 357.12 5.2 5.2
2020-06-08 64.08 0 64.08 64.08
2020-06-10 -371.92 434.48 62.56 62.56
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $75.32
The current status of the model is: Holding a position since 2020-06-10 00:00:00
Processing portfolio for model: EMA_016_SlowMA_35_FastMA_10
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-04 00:00:00 at the price of 288.0
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-08 1 1 319.98 0 0
2019-05-14 -1 0 0 348.71 28.73
2019-06-24 1 1 370.27 0 0
2019-07-19 -1 0 0 323.4 -46.87
2019-11-04 1 1 288 0 0
2020-03-13 -1 0 0 330.51 42.51
2020-03-31 1 1 367.93 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-08 -319.98 320.27 0.29 0.29
2019-05-14 28.73 0 28.73 28.73
2019-06-24 -341.54 371.04 29.5 29.5
2019-07-19 -18.14 0 -18.14 -18.14
2019-11-04 -306.14 292.86 -13.28 -13.28
2020-03-13 24.37 0 24.37 24.37
2020-03-31 -343.56 375.5 31.94 31.94
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $103.68
The current status of the model is: Holding a position since 2020-03-31 00:00:00
Processing portfolio for model: EMA_017_SlowMA_35_FastMA_15
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-15 00:00:00 at the price of 343.34
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-06 00:00:00 at the price of 288.19
SOLD QTY: -1 on 2020-03-16 00:00:00 at the price of 306.63
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-09 1 1 317.71 0 0
2019-05-15 -1 0 0 343.34 25.63
2019-06-25 1 1 370.75 0 0
2019-07-22 -1 0 0 312 -58.75
2019-11-06 1 1 288.19 0 0
2020-03-16 -1 0 0 306.63 18.44
2020-04-01 1 1 376.05 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-09 -317.71 319.96 2.25 2.25
2019-05-15 25.63 0 25.63 25.63
2019-06-25 -345.12 360.3 15.18 15.18
2019-07-22 -33.12 0 -33.12 -33.12
2019-11-06 -321.31 288.59 -32.72 -32.72
2020-03-16 -14.68 0 -14.68 -14.68
2020-04-01 -390.73 364.08 -26.65 -26.65
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $56.51
The current status of the model is: Holding a position since 2020-04-01 00:00:00
Processing portfolio for model: EMA_018_SlowMA_35_FastMA_20
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-20 00:00:00 at the price of 351.23
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-11 00:00:00 at the price of 289.16
SOLD QTY: -1 on 2020-03-17 00:00:00 at the price of 306.18
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-09 1 1 317.71 0 0
2019-05-20 -1 0 0 351.23 33.52
2019-06-25 1 1 370.75 0 0
2019-07-22 -1 0 0 312 -58.75
2019-11-11 1 1 289.16 0 0
2020-03-17 -1 0 0 306.18 17.02
2020-04-01 1 1 376.05 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-09 -317.71 319.96 2.25 2.25
2019-05-20 33.52 0 33.52 33.52
2019-06-25 -337.23 360.3 23.07 23.07
2019-07-22 -25.23 0 -25.23 -25.23
2019-11-11 -314.39 294.18 -20.21 -20.21
2020-03-17 -8.21 0 -8.21 -8.21
2020-04-01 -384.26 364.08 -20.18 -20.18
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $62.98
The current status of the model is: Holding a position since 2020-04-01 00:00:00
Processing portfolio for model: EMA_019_SlowMA_40_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-04-16 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-17 00:00:00 at the price of 365.05
SOLD QTY: -1 on 2019-04-18 00:00:00 at the price of 355.0
BOUGHT QTY: 1 on 2019-04-22 00:00:00 at the price of 359.7
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-21 00:00:00 at the price of 365.0
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-10-18 00:00:00 at the price of 289.36
SOLD QTY: -1 on 2019-10-21 00:00:00 at the price of 272.89
BOUGHT QTY: 1 on 2019-11-01 00:00:00 at the price of 288.7
SOLD QTY: -1 on 2020-03-12 00:00:00 at the price of 326.5
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-07 1 1 302.1 0 0
2019-04-16 -1 0 0 355 52.9
2019-04-17 1 1 365.05 0 0
2019-04-18 -1 0 0 355 -10.05
2019-04-22 1 1 359.7 0 0
2019-05-14 -1 0 0 348.71 -10.99
2019-06-21 1 1 365 0 0
2019-07-19 -1 0 0 323.4 -41.6
2019-10-18 1 1 289.36 0 0
2019-10-21 -1 0 0 272.89 -16.47
2019-11-01 1 1 288.7 0 0
2020-03-12 -1 0 0 326.5 37.8
2020-03-27 1 1 359.09 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-07 -302.1 315.34 13.24 13.24
2019-04-16 52.9 0 52.9 52.9
2019-04-17 -312.15 354.74 42.59 42.59
2019-04-18 42.85 0 42.85 42.85
2019-04-22 -316.85 377.34 60.49 60.49
2019-05-14 31.86 0 31.86 31.86
2019-06-21 -333.14 369.21 36.07 36.07
2019-07-19 -9.74 0 -9.74 -9.74
2019-10-18 -299.1 275.3 -23.8 -23.8
2019-10-21 -26.21 0 -26.21 -26.21
2019-11-01 -314.91 286.81 -28.1 -28.1
2020-03-12 11.59 0 11.59 11.59
2020-03-27 -347.5 357.12 9.62 9.62
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $99.74
The current status of the model is: Holding a position since 2020-03-27 00:00:00
Processing portfolio for model: EMA_020_SlowMA_40_FastMA_10
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-05-15 00:00:00 at the price of 343.34
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-05 00:00:00 at the price of 289.99
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-08 1 1 319.98 0 0
2019-05-15 -1 0 0 343.34 23.36
2019-06-24 1 1 370.27 0 0
2019-07-19 -1 0 0 323.4 -46.87
2019-11-05 1 1 289.99 0 0
2020-03-13 -1 0 0 330.51 40.52
2020-03-31 1 1 367.93 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-08 -319.98 320.27 0.29 0.29
2019-05-15 23.36 0 23.36 23.36
2019-06-24 -346.91 371.04 24.13 24.13
2019-07-19 -23.51 0 -23.51 -23.51
2019-11-05 -313.5 288.03 -25.47 -25.47
2020-03-13 17.01 0 17.01 17.01
2020-03-31 -350.92 375.5 24.58 24.58
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $96.32
The current status of the model is: Holding a position since 2020-03-31 00:00:00
Processing portfolio for model: EMA_021_SlowMA_40_FastMA_15
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-16 00:00:00 at the price of 356.37
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-08 00:00:00 at the price of 288.73
SOLD QTY: -1 on 2020-03-17 00:00:00 at the price of 306.18
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-09 1 1 317.71 0 0
2019-05-16 -1 0 0 356.37 38.66
2019-06-25 1 1 370.75 0 0
2019-07-22 -1 0 0 312 -58.75
2019-11-08 1 1 288.73 0 0
2020-03-17 -1 0 0 306.18 17.45
2020-04-01 1 1 376.05 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-09 -317.71 319.96 2.25 2.25
2019-05-16 38.66 0 38.66 38.66
2019-06-25 -332.09 360.3 28.21 28.21
2019-07-22 -20.09 0 -20.09 -20.09
2019-11-08 -308.82 291.57 -17.25 -17.25
2020-03-17 -2.64 0 -2.64 -2.64
2020-04-01 -378.69 364.08 -14.61 -14.61
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $68.55
The current status of the model is: Holding a position since 2020-04-01 00:00:00
Processing portfolio for model: EMA_022_SlowMA_40_FastMA_20
BOUGHT QTY: 1 on 2019-01-10 00:00:00 at the price of 314.57
SOLD QTY: -1 on 2019-05-21 00:00:00 at the price of 350.95
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-13 00:00:00 at the price of 291.03
SOLD QTY: -1 on 2020-03-17 00:00:00 at the price of 306.18
BOUGHT QTY: 1 on 2020-04-01 00:00:00 at the price of 376.05
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-10 1 1 314.57 0 0
2019-05-21 -1 0 0 350.95 36.38
2019-06-25 1 1 370.75 0 0
2019-07-22 -1 0 0 312 -58.75
2019-11-13 1 1 291.03 0 0
2020-03-17 -1 0 0 306.18 15.15
2020-04-01 1 1 376.05 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-10 -314.57 324.66 10.09 10.09
2019-05-21 36.38 0 36.38 36.38
2019-06-25 -334.37 360.3 25.93 25.93
2019-07-22 -22.37 0 -22.37 -22.37
2019-11-13 -313.4 283.11 -30.29 -30.29
2020-03-17 -7.22 0 -7.22 -7.22
2020-04-01 -383.27 364.08 -19.19 -19.19
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $63.97
The current status of the model is: Holding a position since 2020-04-01 00:00:00
Processing portfolio for model: EMA_023_SlowMA_45_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-21 00:00:00 at the price of 365.0
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-04 00:00:00 at the price of 288.0
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-07 1 1 302.1 0 0
2019-05-14 -1 0 0 348.71 46.61
2019-06-21 1 1 365 0 0
2019-07-19 -1 0 0 323.4 -41.6
2019-11-04 1 1 288 0 0
2020-03-13 -1 0 0 330.51 42.51
2020-03-27 1 1 359.09 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-07 -302.1 315.34 13.24 13.24
2019-05-14 46.61 0 46.61 46.61
2019-06-21 -318.39 369.21 50.82 50.82
2019-07-19 5.01 0 5.01 5.01
2019-11-04 -282.99 292.86 9.87 9.87
2020-03-13 47.52 0 47.52 47.52
2020-03-27 -311.57 357.12 45.55 45.55
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $135.67
The current status of the model is: Holding a position since 2020-03-27 00:00:00
Processing portfolio for model: EMA_024_SlowMA_45_FastMA_10
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-05-15 00:00:00 at the price of 343.34
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-07 00:00:00 at the price of 290.7
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-08 1 1 319.98 0 0
2019-05-15 -1 0 0 343.34 23.36
2019-06-24 1 1 370.27 0 0
2019-07-19 -1 0 0 323.4 -46.87
2019-11-07 1 1 290.7 0 0
2020-03-13 -1 0 0 330.51 39.81
2020-03-31 1 1 367.93 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-08 -319.98 320.27 0.29 0.29
2019-05-15 23.36 0 23.36 23.36
2019-06-24 -346.91 371.04 24.13 24.13
2019-07-19 -23.51 0 -23.51 -23.51
2019-11-07 -314.21 289.57 -24.64 -24.64
2020-03-13 16.3 0 16.3 16.3
2020-03-31 -351.63 375.5 23.87 23.87
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $95.61
The current status of the model is: Holding a position since 2020-03-31 00:00:00
Processing portfolio for model: EMA_025_SlowMA_45_FastMA_15
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-20 00:00:00 at the price of 351.23
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-12 00:00:00 at the price of 295.32
SOLD QTY: -1 on 2020-03-17 00:00:00 at the price of 306.18
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-09 1 1 317.71 0 0
2019-05-20 -1 0 0 351.23 33.52
2019-06-25 1 1 370.75 0 0
2019-07-22 -1 0 0 312 -58.75
2019-11-12 1 1 295.32 0 0
2020-03-17 -1 0 0 306.18 10.86
2020-03-31 1 1 367.93 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-09 -317.71 319.96 2.25 2.25
2019-05-20 33.52 0 33.52 33.52
2019-06-25 -337.23 360.3 23.07 23.07
2019-07-22 -25.23 0 -25.23 -25.23
2019-11-12 -320.55 292.01 -28.54 -28.54
2020-03-17 -14.37 0 -14.37 -14.37
2020-03-31 -382.3 375.5 -6.8 -6.8
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $64.94
The current status of the model is: Holding a position since 2020-03-31 00:00:00
Processing portfolio for model: EMA_026_SlowMA_45_FastMA_20
BOUGHT QTY: 1 on 2019-01-10 00:00:00 at the price of 314.57
SOLD QTY: -1 on 2019-05-22 00:00:00 at the price of 358.01
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-19 00:00:00 at the price of 304.01
SOLD QTY: -1 on 2020-03-18 00:00:00 at the price of 302.395
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-10 1 1 314.57 0 0
2019-05-22 -1 0 0 358.01 43.44
2019-06-25 1 1 370.75 0 0
2019-07-22 -1 0 0 312 -58.75
2019-11-19 1 1 304.01 0 0
2020-03-18 -1 0 0 302.395 -1.615
2020-03-31 1 1 367.93 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-10 -314.57 324.66 10.09 10.09
2019-05-22 43.44 0 43.44 43.44
2019-06-25 -327.31 360.3 32.99 32.99
2019-07-22 -15.31 0 -15.31 -15.31
2019-11-19 -319.32 302.6 -16.72 -16.72
2020-03-18 -16.925 0 -16.925 -16.925
2020-03-31 -384.855 375.5 -9.355 -9.355
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $62.38
The current status of the model is: Holding a position since 2020-03-31 00:00:00
Processing portfolio for model: EMA_027_SlowMA_50_FastMA_05
BOUGHT QTY: 1 on 2019-01-07 00:00:00 at the price of 302.1
SOLD QTY: -1 on 2019-05-14 00:00:00 at the price of 348.71
BOUGHT QTY: 1 on 2019-06-21 00:00:00 at the price of 365.0
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-05 00:00:00 at the price of 289.99
SOLD QTY: -1 on 2020-03-13 00:00:00 at the price of 330.51
BOUGHT QTY: 1 on 2020-03-27 00:00:00 at the price of 359.09
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-07 1 1 302.1 0 0
2019-05-14 -1 0 0 348.71 46.61
2019-06-21 1 1 365 0 0
2019-07-19 -1 0 0 323.4 -41.6
2019-11-05 1 1 289.99 0 0
2020-03-13 -1 0 0 330.51 40.52
2020-03-27 1 1 359.09 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-07 -302.1 315.34 13.24 13.24
2019-05-14 46.61 0 46.61 46.61
2019-06-21 -318.39 369.21 50.82 50.82
2019-07-19 5.01 0 5.01 5.01
2019-11-05 -284.98 288.03 3.05 3.05
2020-03-13 45.53 0 45.53 45.53
2020-03-27 -313.56 357.12 43.56 43.56
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $133.68
The current status of the model is: Holding a position since 2020-03-27 00:00:00
Processing portfolio for model: EMA_028_SlowMA_50_FastMA_10
BOUGHT QTY: 1 on 2019-01-08 00:00:00 at the price of 319.98
SOLD QTY: -1 on 2019-05-16 00:00:00 at the price of 356.37
BOUGHT QTY: 1 on 2019-06-24 00:00:00 at the price of 370.27
SOLD QTY: -1 on 2019-07-19 00:00:00 at the price of 323.4
BOUGHT QTY: 1 on 2019-11-11 00:00:00 at the price of 289.16
SOLD QTY: -1 on 2020-03-16 00:00:00 at the price of 306.63
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-08 1 1 319.98 0 0
2019-05-16 -1 0 0 356.37 36.39
2019-06-24 1 1 370.27 0 0
2019-07-19 -1 0 0 323.4 -46.87
2019-11-11 1 1 289.16 0 0
2020-03-16 -1 0 0 306.63 17.47
2020-03-31 1 1 367.93 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-08 -319.98 320.27 0.29 0.29
2019-05-16 36.39 0 36.39 36.39
2019-06-24 -333.88 371.04 37.16 37.16
2019-07-19 -10.48 0 -10.48 -10.48
2019-11-11 -299.64 294.18 -5.46 -5.46
2020-03-16 6.99 0 6.99 6.99
2020-03-31 -360.94 375.5 14.56 14.56
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $86.30
The current status of the model is: Holding a position since 2020-03-31 00:00:00
Processing portfolio for model: EMA_029_SlowMA_50_FastMA_15
BOUGHT QTY: 1 on 2019-01-09 00:00:00 at the price of 317.71
SOLD QTY: -1 on 2019-05-21 00:00:00 at the price of 350.95
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-18 00:00:00 at the price of 296.0
SOLD QTY: -1 on 2020-03-17 00:00:00 at the price of 306.18
BOUGHT QTY: 1 on 2020-03-31 00:00:00 at the price of 367.93
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-09 1 1 317.71 0 0
2019-05-21 -1 0 0 350.95 33.24
2019-06-25 1 1 370.75 0 0
2019-07-22 -1 0 0 312 -58.75
2019-11-18 1 1 296 0 0
2020-03-17 -1 0 0 306.18 10.18
2020-03-31 1 1 367.93 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-09 -317.71 319.96 2.25 2.25
2019-05-21 33.24 0 33.24 33.24
2019-06-25 -337.51 360.3 22.79 22.79
2019-07-22 -25.51 0 -25.51 -25.51
2019-11-18 -321.51 302.57 -18.94 -18.94
2020-03-17 -15.33 0 -15.33 -15.33
2020-03-31 -383.26 375.5 -7.76 -7.76
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $63.98
The current status of the model is: Holding a position since 2020-03-31 00:00:00
Processing portfolio for model: EMA_030_SlowMA_50_FastMA_20
BOUGHT QTY: 1 on 2019-01-10 00:00:00 at the price of 314.57
SOLD QTY: -1 on 2019-05-24 00:00:00 at the price of 355.41
BOUGHT QTY: 1 on 2019-06-25 00:00:00 at the price of 370.75
SOLD QTY: -1 on 2019-07-22 00:00:00 at the price of 312.0
BOUGHT QTY: 1 on 2019-11-20 00:00:00 at the price of 301.01
SOLD QTY: -1 on 2020-03-19 00:00:00 at the price of 324.33
BOUGHT QTY: 1 on 2020-03-30 00:00:00 at the price of 363.0
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-10 1 1 314.57 0 0
2019-05-24 -1 0 0 355.41 40.84
2019-06-25 1 1 370.75 0 0
2019-07-22 -1 0 0 312 -58.75
2019-11-20 1 1 301.01 0 0
2020-03-19 -1 0 0 324.33 23.32
2020-03-30 1 1 363 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-10 -314.57 324.66 10.09 10.09
2019-05-24 40.84 0 40.84 40.84
2019-06-25 -329.91 360.3 30.39 30.39
2019-07-22 -17.91 0 -17.91 -17.91
2019-11-20 -318.92 305.16 -13.76 -13.76
2020-03-19 5.41 0 5.41 5.41
2020-03-30 -357.59 370.96 13.37 13.37
Accumulated profit/loss for one share of stock with initial capital of $0 at the end of modeling period: $89.65
The current status of the model is: Holding a position since 2020-03-30 00:00:00
# Display the model performance summary
performance_summary.sort_values(by=['return_value'], inplace=True, ascending=False)
print(performance_summary)
model_name return_value return_percent 22 EMA_023_SlowMA_45_FastMA_05 135.670 None 26 EMA_027_SlowMA_50_FastMA_05 133.680 None 15 EMA_016_SlowMA_35_FastMA_10 103.680 None 18 EMA_019_SlowMA_40_FastMA_05 99.740 None 19 EMA_020_SlowMA_40_FastMA_10 96.320 None 23 EMA_024_SlowMA_45_FastMA_10 95.610 None 4 EMA_005_SlowMA_20_FastMA_10 92.045 None 10 EMA_011_SlowMA_30_FastMA_05 91.724 None 9 EMA_010_SlowMA_25_FastMA_20 90.560 None 8 EMA_009_SlowMA_25_FastMA_15 90.160 None 29 EMA_030_SlowMA_50_FastMA_20 89.650 None 1 EMA_002_SlowMA_15_FastMA_05 87.190 None 27 EMA_028_SlowMA_50_FastMA_10 86.300 None 11 EMA_012_SlowMA_30_FastMA_10 82.530 None 13 EMA_014_SlowMA_30_FastMA_20 78.550 None 12 EMA_013_SlowMA_30_FastMA_15 76.800 None 14 EMA_015_SlowMA_35_FastMA_05 75.320 None 2 EMA_003_SlowMA_15_FastMA_10 75.055 None 6 EMA_007_SlowMA_25_FastMA_05 69.515 None 20 EMA_021_SlowMA_40_FastMA_15 68.550 None 24 EMA_025_SlowMA_45_FastMA_15 64.940 None 28 EMA_029_SlowMA_50_FastMA_15 63.980 None 21 EMA_022_SlowMA_40_FastMA_20 63.970 None 17 EMA_018_SlowMA_35_FastMA_20 62.980 None 25 EMA_026_SlowMA_45_FastMA_20 62.385 None 3 EMA_004_SlowMA_20_FastMA_05 59.245 None 16 EMA_017_SlowMA_35_FastMA_15 56.510 None 7 EMA_008_SlowMA_25_FastMA_10 34.920 None 5 EMA_006_SlowMA_20_FastMA_15 10.300 None 0 EMA_001_SlowMA_10_FastMA_05 -13.715 None
# Display the transactions from the top model
top_model = performance_summary.iloc[0]['model_name']
print('The transactions from the top model %s:' % (top_model))
print(portfolio_collection[top_model][portfolio_collection[top_model].trade_action != 0])
The transactions from the top model EMA_023_SlowMA_45_FastMA_05:
trade_action qty_onhand cost_basis sold_transaction gain_loss \
date
2019-01-07 1 1 302.1 0 0
2019-05-14 -1 0 0 348.71 46.61
2019-06-21 1 1 365 0 0
2019-07-19 -1 0 0 323.4 -41.6
2019-11-04 1 1 288 0 0
2020-03-13 -1 0 0 330.51 42.51
2020-03-27 1 1 359.09 0 0
cash_onhand position_value total_position accumu_return
date
2019-01-07 -302.1 315.34 13.24 13.24
2019-05-14 46.61 0 46.61 46.61
2019-06-21 -318.39 369.21 50.82 50.82
2019-07-19 5.01 0 5.01 5.01
2019-11-04 -282.99 292.86 9.87 9.87
2020-03-13 47.52 0 47.52 47.52
2020-03-27 -311.57 357.12 45.55 45.55
# Display the entry and exit signals for the top model
print('The trading signal changes from the top model %s:' % (top_model))
print(model_collection[top_model][model_collection[top_model].signal_change != 0])
The trading signal changes from the top model EMA_023_SlowMA_45_FastMA_05:
open_price close_price fast_ma slow_ma ma_change \
date
2019-01-04 281.88 297.57 275.730669 274.027704 1.702965
2019-05-13 352.29 345.26 359.311786 363.147351 -3.835566
2019-06-20 365.91 365.21 358.288204 355.793544 2.494660
2019-07-18 323.76 325.21 353.858302 363.121323 -9.263021
2019-11-01 288.70 286.81 285.152431 284.890309 0.262122
2020-03-12 326.50 315.25 344.725788 355.997124 -11.271336
2020-03-26 344.00 362.99 350.341988 349.453249 0.888740
trade_signal signal_change entry_exit
date
2019-01-04 1.0 1.0 0.0
2019-05-13 0.0 -1.0 0.0
2019-06-20 1.0 1.0 0.0
2019-07-18 0.0 -1.0 0.0
2019-11-01 1.0 1.0 0.0
2020-03-12 0.0 -1.0 0.0
2020-03-26 1.0 1.0 0.0
graph_data = model_collection[top_model].copy()
title_string = "Exponential Moving Average Crossover Model for " + top_model
fig = plt.figure(figsize=(16,9))
ylabel = stock_symbol + ' price in $'
ax1 = fig.add_subplot(111, ylabel=ylabel, title=title_string)
graph_data['fast_ma'].plot(ax=ax1, color='b', lw=2.)
graph_data['slow_ma'].plot(ax=ax1, color='r', lw=2.)
graph_data['close_price'].plot(ax=ax1, color='g')
ax1.plot(graph_data.loc[graph_data.entry_exit == 1].index, graph_data.close_price[graph_data.entry_exit == 1], '^', markersize=7, color='k',label='buy')
ax1.plot(graph_data.loc[graph_data.entry_exit == -1].index, graph_data.close_price[graph_data.entry_exit == -1], 'v', markersize=7, color='k',label='sell')
plt.legend(loc='upper left')
plt.show()
best_model = ''
best_return = 0
for key in portfolio_collection:
if portfolio_collection[key]['accumu_return'][-1] > best_return:
best_model = key
best_return = portfolio_collection[best_model]['accumu_return'][-1]
print('The best model found is:', best_model)
print('The best profit/loss for the investing period is: $%.2f' % (best_return))
if initial_capital != 0:
print('The best return percentage for initial capital is: %.2f%%' % (best_return / initial_capital * 100))
The best model found is: EMA_023_SlowMA_45_FastMA_05 The best profit/loss for the investing period is: $135.67
worst_model = None
worst_return = 0
for key in portfolio_collection:
if portfolio_collection[key]['accumu_return'][-1] < worst_return:
worst_model = key
worst_return = portfolio_collection[worst_model]['accumu_return'][-1]
print('The worst model found is:', worst_model)
print('The worst profit/loss for the investing period is: $%.2f' % (worst_return))
if initial_capital != 0:
print('The worst return percentage for the initial capital is: %.2f%%' % (worst_return / initial_capital * 100))
The worst model found is: EMA_001_SlowMA_10_FastMA_05 The worst profit/loss for the investing period is: $-13.72
# Calculate the stock's performance for a long-only model
model_template = model_template[model_start_date:model_end_date]
print('The performance of the long-only model from day one is: $%.2f' %(model_template.iloc[-1]['close_price'] - model_template.iloc[0]['open_price']))
The performance of the long-only model from day one is: $187.96
print ('Total time for the script:',(datetime.now() - startTimeScript))
Total time for the script: 0:00:44.459505